Lets say we have a structure as below-
struct test
{
int a;
int b;
};
I make a atomic variable of this structure and try to update a and b. Will these operations be atomic? What does it mean to make a structure/class atomic?
std::atomic<test> t;
t.a = 10; // is this an atomic operation?
t.b = 20; // is this an atomic operation?
// I understand a and b are not atomic in themselves but I am confused
// as to when you say struct temp is atomic what does it mean?
// does it mean the t instance's this pointer is atomic?