The atomic types (C++11)

Objects of the atomic types are free from data races. You can create atomic objects by using the following atomic types:
template< class T > struct atomic;      //The generic atomic type
    
 
template < > struct atomic<Integral>;   //Full specializations for integral types
  

template< class T > struct atomic<T*>;  //Partial specializations for all pointer 
                                        //types

Specializations and instantiations of the atomic template must have a deleted copy constructor, a deleted copy assignment operator, and a constexpr value constructor.

The standard library provides full specializations of the atomic template for integral types, one full specialization for the bool type, and partial specializations for all pointer types. Each of these specializations has standard layout, a trivial default constructor, and a trivial destructor. They all support aggregate initialization syntax.

The following table shows typedef names and the corresponding full specializations for the bool type and integral types.
Table 1. Typedef names and corresponding full specializations
Typedef name Full specialization
atomic_bool atomic<bool>
atomic_char atomic<char>
atomic_schar atomic<schar>
atomic_uchar atomic<unsigned char>
atomic_short atomic<short>
atomic_ushort atomic<unsigned short>
atomic_int atomic<int>
atomic_uint atomic<unsigned int>
atomic_long atomic<long>
atomic_ulong atomic<unsigned long>
atomic_llong atomic<long long>
atomic_ullong atomic<unsigned long long>
atomic_char16_t atomic<char16_t>
atomic_char32_t atomic<char32_t>
atomic_wchar_t atomic<wchar_t>
atomic_int_least8_t atomic<int_least8_t>
atomic_uint_least8_t atomic<uint_least8_t>
atomic_int_least16_t atomic<int_least16_t>
atomic_uint_least16_t atomic<uint_least16_t>
atomic_int_least32_t atomic<int_least32_t>
atomic_uint_least32_t atomic<uint_least32_t>
atomic_int_least64_t atomic<int_least64_t>
atomic_uint_least64_t atomic<uint_least64_t>
atomic_int_fast8_t atomic<int_fast8_t>
atomic_uint_fast8_t atomic<uint_fast8_t>
atomic_int_fast16_t atomic<int_fast16_t>
atomic_uint_fast16_t atomic<uint_fast16_t>
atomic_int_fast32_t atomic<int_fast32_t>
atomic_uint_fast32_t atomic<uint_fast32_t>
atomic_int_fast64_t atomic<int_fast64_t>
atomic_uint_fast64_t atomic<uint_fast64_t>
atomic_intptr_t atomic<intptr_t>
atomic_uintptr_t atomic<uintptr_t>
atomic_size_t atomic<size_t>
atomic_ptrdiff_t atomic<ptrdiff_t>
atomic_intmax_t atomic<intmax_t>
atomic_uintmax_t atomic<uintmax_t>