Share via


atomic::atomic Constructor

Constructs an atomic object.

atomic();
atomic( const atomic& );
atomic( Ty Val ) _NOEXCEPT;

Parameters

  • _Val
    Initialization value.

Remarks

Atomic objects cannot be copied or moved.

Objects that are instantiations of atomic<Ty> can be initialized only by the constructor that takes an argument of type Ty and not by using aggregate initialization. However, **atomic_**integral objects can be initialized only by using aggregate initialization.

atomic<int> ai0 = ATOMIC_VAR_INIT(0);
atomic<int> ai1(0);

Requirements

Header: atomic

Namespace: std

See Also

Reference

<atomic>

atomic Structure