C++ Standard Library atomic types and operations
We will now introduce the data types and functions provided by the C++ Standard Library to support atomic types and operations. As we have already seen, an atomic operation is an indivisible operation. To be able to perform atomic operations in C++, we need to use the atomic types provided by the C++ Standard Library.
C++ Standard Library atomic types
The atomic types provided by the C++ Standard Library are defined in the <atomic> header file.
You can see the documentation for all the atomic types defined in the <atomic> header in the online C++ reference, which you can access at https://en.cppreference.com/w/cpp/atomic/atomic. We won’t include all the content in this reference here (that’s what the reference is for!), but we will introduce the main concepts and use examples to further elaborate our explanations.
The atomic types provided by the C++ Standard Library are the following:
std...