From Jason Turner

[atomics.types.generic.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwr2a1p_f/{from.md → to.md} +69 -0
tmp/tmpwr2a1p_f/{from.md → to.md} RENAMED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### General <a id="atomics.types.generic.general">[[atomics.types.generic.general]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ template<class T> struct atomic {
6
+ using value_type = T;
7
+
8
+ static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic type's operations are always lock free;
9
+ bool is_lock_free() const volatile noexcept;
10
+ bool is_lock_free() const noexcept;
11
+
12
+ // [atomics.types.operations], operations on atomic types
13
+ constexpr atomic() noexcept(is_nothrow_default_constructible_v<T>);
14
+ constexpr atomic(T) noexcept;
15
+ atomic(const atomic&) = delete;
16
+ atomic& operator=(const atomic&) = delete;
17
+ atomic& operator=(const atomic&) volatile = delete;
18
+
19
+ T load(memory_order = memory_order::seq_cst) const volatile noexcept;
20
+ T load(memory_order = memory_order::seq_cst) const noexcept;
21
+ operator T() const volatile noexcept;
22
+ operator T() const noexcept;
23
+ void store(T, memory_order = memory_order::seq_cst) volatile noexcept;
24
+ void store(T, memory_order = memory_order::seq_cst) noexcept;
25
+ T operator=(T) volatile noexcept;
26
+ T operator=(T) noexcept;
27
+
28
+ T exchange(T, memory_order = memory_order::seq_cst) volatile noexcept;
29
+ T exchange(T, memory_order = memory_order::seq_cst) noexcept;
30
+ bool compare_exchange_weak(T&, T, memory_order, memory_order) volatile noexcept;
31
+ bool compare_exchange_weak(T&, T, memory_order, memory_order) noexcept;
32
+ bool compare_exchange_strong(T&, T, memory_order, memory_order) volatile noexcept;
33
+ bool compare_exchange_strong(T&, T, memory_order, memory_order) noexcept;
34
+ bool compare_exchange_weak(T&, T, memory_order = memory_order::seq_cst) volatile noexcept;
35
+ bool compare_exchange_weak(T&, T, memory_order = memory_order::seq_cst) noexcept;
36
+ bool compare_exchange_strong(T&, T, memory_order = memory_order::seq_cst) volatile noexcept;
37
+ bool compare_exchange_strong(T&, T, memory_order = memory_order::seq_cst) noexcept;
38
+
39
+ void wait(T, memory_order = memory_order::seq_cst) const volatile noexcept;
40
+ void wait(T, memory_order = memory_order::seq_cst) const noexcept;
41
+ void notify_one() volatile noexcept;
42
+ void notify_one() noexcept;
43
+ void notify_all() volatile noexcept;
44
+ void notify_all() noexcept;
45
+ };
46
+ }
47
+ ```
48
+
49
+ The template argument for `T` shall meet the *Cpp17CopyConstructible*
50
+ and *Cpp17CopyAssignable* requirements. The program is ill-formed if any
51
+ of
52
+
53
+ - `is_trivially_copyable_v<T>`,
54
+ - `is_copy_constructible_v<T>`,
55
+ - `is_move_constructible_v<T>`,
56
+ - `is_copy_assignable_v<T>`, or
57
+ - `is_move_assignable_v<T>`
58
+
59
+ is `false`.
60
+
61
+ [*Note 1*: Type arguments that are not also statically initializable
62
+ can be difficult to use. — *end note*]
63
+
64
+ The specialization `atomic<bool>` is a standard-layout struct.
65
+
66
+ [*Note 2*: The representation of an atomic specialization need not have
67
+ the same size and alignment requirement as its corresponding argument
68
+ type. — *end note*]
69
+