std::atomic<T>::atomic - cppreference.com
From cppreference.com
| (1) | ||
|
(since C++11) (until C++20) |
|
|
|
(since C++20) | |
|
|
(2) | (since C++11) |
|
|
(3) | (since C++11) |
Constructs a new atomic variable.
1) Value-initializes the underlying object (i.e. with T()). The initialization is not atomic.
This overload participates in overload resolution only if std::is_default_constructible_v<T> is true.
2) Initializes the underlying object with desired. The initialization is not atomic.
Parameters
| desired | - | value to initialize with |
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 4169 | C++11 | std::is_default_constructible_v could report false positive | the default constructor is constrained |
| LWG 2334 | C++11 | The default-initialized does not contain T object | Corrected |