std::atomic::atomic - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::atomic::atomic

From cppreference.com
< cpp‎ | atomic‎ | atomic

atomic() = default; | (1) | (since C++11)
constexpr atomic( T desired ); | (2) | (since C++11)
atomic( const atomic& ) = delete; | (3) | (since C++11)

Constructs new atomic variable.

1) The default constructor is trivial: no initialization takes place other than zero initialization of static and thread-local objects. std::atomic_init may be used to complete initialization.
2) Initializes the underlying value with `desired`. The initialization is not atomic.
3) Atomic variables are not `CopyConstructible`.

### [edit] Parameters

desired | - | value to initialize with

### [edit] Exceptions

`noexcept` specification:
noexcept

### [edit] Notes

The default-initialized std::atomic<T> does not contain a `T` object, and its only valid uses are destruction and initialization by std::atomic_init, see LWG 2334

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/atomic/atomic/atomic&oldid=91317"
Category:

- unconditionally noexcept

Hidden categories:

- Pages with unreviewed unconditional noexcept template
- Pages with unreviewed noexcept template