From Jason Turner

[atomics.types.int]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_uo5j5dl/{from.md → to.md} +116 -38
tmp/tmp_uo5j5dl/{from.md → to.md} RENAMED
@@ -27,85 +27,122 @@ namespace std {
27
  atomic(const atomic&) = delete;
28
  atomic& operator=(const atomic&) = delete;
29
  atomic& operator=(const atomic&) volatile = delete;
30
 
31
  void store(integral-type, memory_order = memory_order::seq_cst) volatile noexcept;
32
- void store(integral-type, memory_order = memory_order::seq_cst) noexcept;
33
  integral-type operator=(integral-type) volatile noexcept;
34
- integral-type operator=(integral-type) noexcept;
35
  integral-type load(memory_order = memory_order::seq_cst) const volatile noexcept;
36
- integral-type load(memory_order = memory_order::seq_cst) const noexcept;
37
  operator integral-type() const volatile noexcept;
38
- operator integral-type() const noexcept;
39
 
40
  integral-type exchange(integral-type,
41
  memory_order = memory_order::seq_cst) volatile noexcept;
42
- integral-type exchange(integral-type,
43
  memory_order = memory_order::seq_cst) noexcept;
44
  bool compare_exchange_weak(integral-type&, integral-type,
45
  memory_order, memory_order) volatile noexcept;
46
- bool compare_exchange_weak(integral-type&, integral-type,
47
  memory_order, memory_order) noexcept;
48
  bool compare_exchange_strong(integral-type&, integral-type,
49
  memory_order, memory_order) volatile noexcept;
50
- bool compare_exchange_strong(integral-type&, integral-type,
51
  memory_order, memory_order) noexcept;
52
  bool compare_exchange_weak(integral-type&, integral-type,
53
  memory_order = memory_order::seq_cst) volatile noexcept;
54
- bool compare_exchange_weak(integral-type&, integral-type,
55
  memory_order = memory_order::seq_cst) noexcept;
56
  bool compare_exchange_strong(integral-type&, integral-type,
57
  memory_order = memory_order::seq_cst) volatile noexcept;
58
- bool compare_exchange_strong(integral-type&, integral-type,
59
  memory_order = memory_order::seq_cst) noexcept;
60
 
61
  integral-type fetch_add(integral-type,
62
  memory_order = memory_order::seq_cst) volatile noexcept;
63
- integral-type fetch_add(integral-type,
64
  memory_order = memory_order::seq_cst) noexcept;
65
  integral-type fetch_sub(integral-type,
66
  memory_order = memory_order::seq_cst) volatile noexcept;
67
- integral-type fetch_sub(integral-type,
68
  memory_order = memory_order::seq_cst) noexcept;
69
  integral-type fetch_and(integral-type,
70
  memory_order = memory_order::seq_cst) volatile noexcept;
71
- integral-type fetch_and(integral-type,
72
  memory_order = memory_order::seq_cst) noexcept;
73
  integral-type fetch_or(integral-type,
74
  memory_order = memory_order::seq_cst) volatile noexcept;
75
- integral-type fetch_or(integral-type,
76
  memory_order = memory_order::seq_cst) noexcept;
77
  integral-type fetch_xor(integral-type,
78
  memory_order = memory_order::seq_cst) volatile noexcept;
79
- integral-type fetch_xor(integral-type,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  memory_order = memory_order::seq_cst) noexcept;
81
 
82
  integral-type operator++(int) volatile noexcept;
83
- integral-type operator++(int) noexcept;
84
  integral-type operator--(int) volatile noexcept;
85
- integral-type operator--(int) noexcept;
86
  integral-type operator++() volatile noexcept;
87
- integral-type operator++() noexcept;
88
  integral-type operator--() volatile noexcept;
89
- integral-type operator--() noexcept;
90
  integral-type operator+=(integral-type) volatile noexcept;
91
- integral-type operator+=(integral-type) noexcept;
92
  integral-type operator-=(integral-type) volatile noexcept;
93
- integral-type operator-=(integral-type) noexcept;
94
  integral-type operator&=(integral-type) volatile noexcept;
95
- integral-type operator&=(integral-type) noexcept;
96
  integral-type operator|=(integral-type) volatile noexcept;
97
- integral-type operator|=(integral-type) noexcept;
98
  integral-type operator^=(integral-type) volatile noexcept;
99
- integral-type operator^=(integral-type) noexcept;
100
 
101
  void wait(integral-type, memory_order = memory_order::seq_cst) const volatile noexcept;
102
- void wait(integral-type, memory_order = memory_order::seq_cst) const noexcept;
103
  void notify_one() volatile noexcept;
104
- void notify_one() noexcept;
105
  void notify_all() volatile noexcept;
106
- void notify_all() noexcept;
107
  };
108
  }
109
  ```
110
 
111
  The atomic integral specializations are standard-layout structs. They
@@ -119,18 +156,21 @@ correspondence among key, operator, and computation is specified in
119
  [[atomic.types.int.comp]].
120
 
121
  **Table: Atomic arithmetic computations** <a id="atomic.types.int.comp">[atomic.types.int.comp]</a>
122
 
123
  | | | | | | |
124
- | ----- | --- | -------------------- | ----- | --- | -------------------- |
125
- | `add` | `+` | addition | `sub` | `-` | subtraction |
126
- | `or` | `|` | bitwise inclusive or | `xor` | `^` | bitwise exclusive or |
127
- | `and` | `&` | bitwise and | | | |
 
128
 
129
  ``` cpp
130
- T fetch_key(T operand, memory_order order = memory_order::seq_cst) volatile noexcept;
131
- T fetch_key(T operand, memory_order order = memory_order::seq_cst) noexcept;
 
 
132
  ```
133
 
134
  *Constraints:* For the `volatile` overload of this function,
135
  `is_always_lock_free` is `true`.
136
 
@@ -141,21 +181,59 @@ the given `operand`. Memory is affected according to the value of
141
  operations [[intro.multithread]].
142
 
143
  *Returns:* Atomically, the value pointed to by `this` immediately before
144
  the effects.
145
 
146
- *Remarks:* For signed integer types, the result is as if the object
147
- value and parameters were converted to their corresponding unsigned
148
- types, the computation performed on those types, and the result
149
- converted back to the signed type.
150
 
151
  [*Note 1*: There are no undefined results arising from the
152
  computation. — *end note*]
153
 
 
 
 
 
 
154
  ``` cpp
155
- T operator op=(T operand) volatile noexcept;
156
- T operator op=(T operand) noexcept;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  ```
158
 
159
  *Constraints:* For the `volatile` overload of this function,
160
  `is_always_lock_free` is `true`.
161
 
 
27
  atomic(const atomic&) = delete;
28
  atomic& operator=(const atomic&) = delete;
29
  atomic& operator=(const atomic&) volatile = delete;
30
 
31
  void store(integral-type, memory_order = memory_order::seq_cst) volatile noexcept;
32
+ constexpr void store(integral-type, memory_order = memory_order::seq_cst) noexcept;
33
  integral-type operator=(integral-type) volatile noexcept;
34
+ constexpr integral-type operator=(integral-type) noexcept;
35
  integral-type load(memory_order = memory_order::seq_cst) const volatile noexcept;
36
+ constexpr integral-type load(memory_order = memory_order::seq_cst) const noexcept;
37
  operator integral-type() const volatile noexcept;
38
+ constexpr operator integral-type() const noexcept;
39
 
40
  integral-type exchange(integral-type,
41
  memory_order = memory_order::seq_cst) volatile noexcept;
42
+ constexpr integral-type exchange(integral-type,
43
  memory_order = memory_order::seq_cst) noexcept;
44
  bool compare_exchange_weak(integral-type&, integral-type,
45
  memory_order, memory_order) volatile noexcept;
46
+ constexpr bool compare_exchange_weak(integral-type&, integral-type,
47
  memory_order, memory_order) noexcept;
48
  bool compare_exchange_strong(integral-type&, integral-type,
49
  memory_order, memory_order) volatile noexcept;
50
+ constexpr bool compare_exchange_strong(integral-type&, integral-type,
51
  memory_order, memory_order) noexcept;
52
  bool compare_exchange_weak(integral-type&, integral-type,
53
  memory_order = memory_order::seq_cst) volatile noexcept;
54
+ constexpr bool compare_exchange_weak(integral-type&, integral-type,
55
  memory_order = memory_order::seq_cst) noexcept;
56
  bool compare_exchange_strong(integral-type&, integral-type,
57
  memory_order = memory_order::seq_cst) volatile noexcept;
58
+ constexpr bool compare_exchange_strong(integral-type&, integral-type,
59
  memory_order = memory_order::seq_cst) noexcept;
60
 
61
  integral-type fetch_add(integral-type,
62
  memory_order = memory_order::seq_cst) volatile noexcept;
63
+ constexpr integral-type fetch_add(integral-type,
64
  memory_order = memory_order::seq_cst) noexcept;
65
  integral-type fetch_sub(integral-type,
66
  memory_order = memory_order::seq_cst) volatile noexcept;
67
+ constexpr integral-type fetch_sub(integral-type,
68
  memory_order = memory_order::seq_cst) noexcept;
69
  integral-type fetch_and(integral-type,
70
  memory_order = memory_order::seq_cst) volatile noexcept;
71
+ constexpr integral-type fetch_and(integral-type,
72
  memory_order = memory_order::seq_cst) noexcept;
73
  integral-type fetch_or(integral-type,
74
  memory_order = memory_order::seq_cst) volatile noexcept;
75
+ constexpr integral-type fetch_or(integral-type,
76
  memory_order = memory_order::seq_cst) noexcept;
77
  integral-type fetch_xor(integral-type,
78
  memory_order = memory_order::seq_cst) volatile noexcept;
79
+ constexpr integral-type fetch_xor(integral-type,
80
+ memory_order = memory_order::seq_cst) noexcept;
81
+ integral-type fetch_max(integral-type,
82
+ memory_order = memory_order::seq_cst) volatile noexcept;
83
+ constexpr integral-type fetch_max(integral-type,
84
+ memory_order = memory_order::seq_cst) noexcept;
85
+ integral-type fetch_min(integral-type,
86
+ memory_order = memory_order::seq_cst) volatile noexcept;
87
+ constexpr integral-type fetch_min(integral-type,
88
+ memory_order = memory_order::seq_cst) noexcept;
89
+
90
+ void store_add(integral-type,
91
+ memory_order = memory_order::seq_cst) volatile noexcept;
92
+ constexpr void store_add(integral-type,
93
+ memory_order = memory_order::seq_cst) noexcept;
94
+ void store_sub(integral-type,
95
+ memory_order = memory_order::seq_cst) volatile noexcept;
96
+ constexpr void store_sub(integral-type,
97
+ memory_order = memory_order::seq_cst) noexcept;
98
+ void store_and(integral-type,
99
+ memory_order = memory_order::seq_cst) volatile noexcept;
100
+ constexpr void store_and(integral-type,
101
+ memory_order = memory_order::seq_cst) noexcept;
102
+ void store_or(integral-type,
103
+ memory_order = memory_order::seq_cst) volatile noexcept;
104
+ constexpr void store_or(integral-type,
105
+ memory_order = memory_order::seq_cst) noexcept;
106
+ void store_xor(integral-type,
107
+ memory_order = memory_order::seq_cst) volatile noexcept;
108
+ constexpr void store_xor(integral-type,
109
+ memory_order = memory_order::seq_cst) noexcept;
110
+ void store_max(integral-type,
111
+ memory_order = memory_order::seq_cst) volatile noexcept;
112
+ constexpr void store_max(integral-type,
113
+ memory_order = memory_order::seq_cst) noexcept;
114
+ void store_min(integral-type,
115
+ memory_order = memory_order::seq_cst) volatile noexcept;
116
+ constexpr void store_min(integral-type,
117
  memory_order = memory_order::seq_cst) noexcept;
118
 
119
  integral-type operator++(int) volatile noexcept;
120
+ constexpr integral-type operator++(int) noexcept;
121
  integral-type operator--(int) volatile noexcept;
122
+ constexpr integral-type operator--(int) noexcept;
123
  integral-type operator++() volatile noexcept;
124
+ constexpr integral-type operator++() noexcept;
125
  integral-type operator--() volatile noexcept;
126
+ constexpr integral-type operator--() noexcept;
127
  integral-type operator+=(integral-type) volatile noexcept;
128
+ constexpr integral-type operator+=(integral-type) noexcept;
129
  integral-type operator-=(integral-type) volatile noexcept;
130
+ constexpr integral-type operator-=(integral-type) noexcept;
131
  integral-type operator&=(integral-type) volatile noexcept;
132
+ constexpr integral-type operator&=(integral-type) noexcept;
133
  integral-type operator|=(integral-type) volatile noexcept;
134
+ constexpr integral-type operator|=(integral-type) noexcept;
135
  integral-type operator^=(integral-type) volatile noexcept;
136
+ constexpr integral-type operator^=(integral-type) noexcept;
137
 
138
  void wait(integral-type, memory_order = memory_order::seq_cst) const volatile noexcept;
139
+ constexpr void wait(integral-type, memory_order = memory_order::seq_cst) const noexcept;
140
  void notify_one() volatile noexcept;
141
+ constexpr void notify_one() noexcept;
142
  void notify_all() volatile noexcept;
143
+ constexpr void notify_all() noexcept;
144
  };
145
  }
146
  ```
147
 
148
  The atomic integral specializations are standard-layout structs. They
 
156
  [[atomic.types.int.comp]].
157
 
158
  **Table: Atomic arithmetic computations** <a id="atomic.types.int.comp">[atomic.types.int.comp]</a>
159
 
160
  | | | | | | |
161
+ | ----- | --- | ----------- | ----- | --- | -------------------- |
162
+ | `add` | `+` | addition | `and` | `&` | bitwise and |
163
+ | `sub` | `-` | subtraction | `or` | `|` | bitwise inclusive or |
164
+ | `max` | | maximum | `xor` | `^` | bitwise exclusive or |
165
+ | `min` | | minimum | | | |
166
 
167
  ``` cpp
168
+ integral-type fetch_key(integral-type operand,
169
+ memory_order order = memory_order::seq_cst) volatile noexcept;
170
+ constexpr integral-type fetch_key(integral-type operand,
171
+ memory_order order = memory_order::seq_cst) noexcept;
172
  ```
173
 
174
  *Constraints:* For the `volatile` overload of this function,
175
  `is_always_lock_free` is `true`.
176
 
 
181
  operations [[intro.multithread]].
182
 
183
  *Returns:* Atomically, the value pointed to by `this` immediately before
184
  the effects.
185
 
186
+ *Remarks:* Except for `fetch_max` and `fetch_min`, for signed integer
187
+ types the result is as if the object value and parameters were converted
188
+ to their corresponding unsigned types, the computation performed on
189
+ those types, and the result converted back to the signed type.
190
 
191
  [*Note 1*: There are no undefined results arising from the
192
  computation. — *end note*]
193
 
194
+ For `fetch_max` and `fetch_min`, the maximum and minimum computation is
195
+ performed as if by `max` and `min` algorithms [[alg.min.max]],
196
+ respectively, with the object value and the first parameter as the
197
+ arguments.
198
+
199
  ``` cpp
200
+ void store_key(integral-type operand,
201
+ memory_order order = memory_order::seq_cst) volatile noexcept;
202
+ constexpr void store_key(integral-type operand,
203
+ memory_order order = memory_order::seq_cst) noexcept;
204
+ ```
205
+
206
+ *Constraints:* For the `volatile` overload of this function,
207
+ `is_always_lock_free` is `true`.
208
+
209
+ *Preconditions:* `order` is `memory_order::relaxed`,
210
+ `memory_order::release`, or `memory_order::seq_cst`.
211
+
212
+ *Effects:* Atomically replaces the value pointed to by `this` with the
213
+ result of the computation applied to the value pointed to by `this` and
214
+ the given `operand`. Memory is affected according to the value of
215
+ `order`. These operations are atomic modify-write
216
+ operations [[atomics.order]].
217
+
218
+ *Remarks:* Except for `store_max` and `store_min`, for signed integer
219
+ types, the result is as if the value pointed to by `this` and parameters
220
+ were converted to their corresponding unsigned types, the computation
221
+ performed on those types, and the result converted back to the signed
222
+ type.
223
+
224
+ [*Note 2*: There are no undefined results arising from the
225
+ computation. — *end note*]
226
+
227
+ For `store_max` and `store_min`, the maximum and minimum computation is
228
+ performed as if by `max` and `min` algorithms [[alg.min.max]],
229
+ respectively, with the value pointed to by `this` and the first
230
+ parameter as the arguments.
231
+
232
+ ``` cpp
233
+ integral-type operator op=(integral-type operand) volatile noexcept;
234
+ constexpr integral-type operator op=(integral-type operand) noexcept;
235
  ```
236
 
237
  *Constraints:* For the `volatile` overload of this function,
238
  `is_always_lock_free` is `true`.
239