I have this simple class structure:
class Animal {
public:
int x;
Animal(int x) {
this->x = x;
}
}
I am using more threads, so I use <atomic>
to handle reading and writing in one variable from more threads.
std::atomic<Animal> animal = Animal(5);
animal.load().x // 5
But how can I store a specific value to a specific attribute?
??? animal.store().x = 10 ???
Aucun commentaire:
Enregistrer un commentaire