cpp/atomic/atomic ref

The class template applies atomic operations to the object it references. For the lifetime of the object, the object it references is considered an atomic object. If one thread writes to an atomic object while another thread reads from it, the behavior is well-defined (see for details on data races). In addition, accesses to atomic objects may establish inter-thread synchronization and order non-atomic memory accesses as specified by std.

The lifetime of an object must exceed the lifetime of all s that references the object. While any instance referencing an object exists, the object must be exclusively accessed through these  instances. No subobject of an object referenced by an object may be concurrently referenced by any other  object.

Atomic operations applied to an object through an are atomic with respect to atomic operations applied through any other  referencing the same object.

is.

Like language references, constness is shallow for - it is possible to modify the referenced value through a   object.

Primary template
The primary template may be instantiated with any  type  (including ):

Partial specialization for pointer types
The standard library provides partial specializations of the template for all pointer types. In addition to the operations provided for all atomic types, these specializations additionally support atomic arithmetic operations appropriate to pointer types, such as,.

Specializations for integral types
When instantiated with one of the following integral types, provides additional atomic operations appropriate to integral types such as, , , , :
 * The character types, , , , and ;
 * The standard signed integer types:, , , , and ;
 * The standard unsigned integer types:, , , , and ;
 * Any additional integral types needed by the typedefs in the header.

Signed integer arithmetic is defined to use two's complement; there are no undefined results.

Specializations for floating-point types
When instantiated with one of the cv-unqualified floating-point types, provides additional atomic operations appropriate to floating-point types such as  and.

No operations result in undefined behavior even if the result is not representable in the floating-point type. The floating-point environment in effect may be different from the calling thread's floating-point environment.

Member types
}

For every (whether or not specialized),  is.

is not defined in the primary template.