June 2018
Intermediate to advanced
348 pages
8h 45m
English
The primary class template in the standard library allows the user to create an atomic variant of a user-defined type (UDT). To use a user-defined type as an atomic type, you have to follow some criteria before implementing the class. For a user-defined class UDT, std::atomic<UDT> is possible if this type has a trivial copy-assignment operator. This means that the user-defined class should not contain any virtual functions or virtual base classes and must use the compiler-generated default copy-assignment operator. Also, every base class and non-static data member of the user-defined class must have a trivial copy-assignment operator. This allows the compiler to execute memcpy() or an equivalent operation ...
Read now
Unlock full access