From Jason Turner

[atomics.types.pointer]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0dykoirl/{from.md → to.md} +75 -23
tmp/tmp0dykoirl/{from.md → to.md} RENAMED
@@ -15,57 +15,70 @@ namespace std {
15
  atomic(const atomic&) = delete;
16
  atomic& operator=(const atomic&) = delete;
17
  atomic& operator=(const atomic&) volatile = delete;
18
 
19
  void store(T*, memory_order = memory_order::seq_cst) volatile noexcept;
20
- void store(T*, memory_order = memory_order::seq_cst) noexcept;
21
  T* operator=(T*) volatile noexcept;
22
- T* operator=(T*) noexcept;
23
  T* load(memory_order = memory_order::seq_cst) const volatile noexcept;
24
- T* load(memory_order = memory_order::seq_cst) const noexcept;
25
  operator T*() const volatile noexcept;
26
- operator T*() const 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*,
35
  memory_order = memory_order::seq_cst) volatile noexcept;
36
- bool compare_exchange_weak(T*&, T*,
37
  memory_order = memory_order::seq_cst) noexcept;
38
  bool compare_exchange_strong(T*&, T*,
39
  memory_order = memory_order::seq_cst) volatile noexcept;
40
- bool compare_exchange_strong(T*&, T*,
41
  memory_order = memory_order::seq_cst) noexcept;
42
 
43
  T* fetch_add(ptrdiff_t, memory_order = memory_order::seq_cst) volatile noexcept;
44
- T* fetch_add(ptrdiff_t, memory_order = memory_order::seq_cst) noexcept;
45
  T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst) volatile noexcept;
46
- T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst) noexcept;
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  T* operator++(int) volatile noexcept;
49
- T* operator++(int) noexcept;
50
  T* operator--(int) volatile noexcept;
51
- T* operator--(int) noexcept;
52
  T* operator++() volatile noexcept;
53
- T* operator++() noexcept;
54
  T* operator--() volatile noexcept;
55
- T* operator--() noexcept;
56
  T* operator+=(ptrdiff_t) volatile noexcept;
57
- T* operator+=(ptrdiff_t) noexcept;
58
  T* operator-=(ptrdiff_t) volatile noexcept;
59
- T* operator-=(ptrdiff_t) noexcept;
60
 
61
  void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept;
62
- void wait(T*, memory_order = memory_order::seq_cst) const noexcept;
63
  void notify_one() volatile noexcept;
64
- void notify_one() noexcept;
65
  void notify_all() volatile noexcept;
66
- void notify_all() noexcept;
67
  };
68
  }
69
  ```
70
 
71
  There is a partial specialization of the `atomic` class template for
@@ -82,14 +95,15 @@ among key, operator, and computation is specified in
82
  **Table: Atomic pointer computations** <a id="atomic.types.pointer.comp">[atomic.types.pointer.comp]</a>
83
 
84
  | | | | | | |
85
  | ----- | --- | -------- | ----- | --- | ----------- |
86
  | `add` | `+` | addition | `sub` | `-` | subtraction |
 
87
 
88
  ``` cpp
89
- T* fetch_key(ptrdiff_t operand, memory_order order = memory_order::seq_cst) volatile noexcept;
90
- T* fetch_key(ptrdiff_t operand, memory_order order = memory_order::seq_cst) noexcept;
91
  ```
92
 
93
  *Constraints:* For the `volatile` overload of this function,
94
  `is_always_lock_free` is `true`.
95
 
@@ -108,13 +122,51 @@ operations [[intro.multithread]].
108
  the effects.
109
 
110
  *Remarks:* The result may be an undefined address, but the operations
111
  otherwise have no undefined behavior.
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  ``` cpp
114
  T* operator op=(ptrdiff_t operand) volatile noexcept;
115
- T* operator op=(ptrdiff_t operand) noexcept;
116
  ```
117
 
118
  *Constraints:* For the `volatile` overload of this function,
119
  `is_always_lock_free` is `true`.
120
 
 
15
  atomic(const atomic&) = delete;
16
  atomic& operator=(const atomic&) = delete;
17
  atomic& operator=(const atomic&) volatile = delete;
18
 
19
  void store(T*, memory_order = memory_order::seq_cst) volatile noexcept;
20
+ constexpr void store(T*, memory_order = memory_order::seq_cst) noexcept;
21
  T* operator=(T*) volatile noexcept;
22
+ constexpr T* operator=(T*) noexcept;
23
  T* load(memory_order = memory_order::seq_cst) const volatile noexcept;
24
+ constexpr T* load(memory_order = memory_order::seq_cst) const noexcept;
25
  operator T*() const volatile noexcept;
26
+ constexpr operator T*() const noexcept;
27
 
28
  T* exchange(T*, memory_order = memory_order::seq_cst) volatile noexcept;
29
+ constexpr T* exchange(T*, memory_order = memory_order::seq_cst) noexcept;
30
  bool compare_exchange_weak(T*&, T*, memory_order, memory_order) volatile noexcept;
31
+ constexpr 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
+ constexpr bool compare_exchange_strong(T*&, T*, memory_order, memory_order) noexcept;
34
  bool compare_exchange_weak(T*&, T*,
35
  memory_order = memory_order::seq_cst) volatile noexcept;
36
+ constexpr bool compare_exchange_weak(T*&, T*,
37
  memory_order = memory_order::seq_cst) noexcept;
38
  bool compare_exchange_strong(T*&, T*,
39
  memory_order = memory_order::seq_cst) volatile noexcept;
40
+ constexpr bool compare_exchange_strong(T*&, T*,
41
  memory_order = memory_order::seq_cst) noexcept;
42
 
43
  T* fetch_add(ptrdiff_t, memory_order = memory_order::seq_cst) volatile noexcept;
44
+ constexpr T* fetch_add(ptrdiff_t, memory_order = memory_order::seq_cst) noexcept;
45
  T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst) volatile noexcept;
46
+ constexpr T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst) noexcept;
47
+ T* fetch_max(T*, memory_order = memory_order::seq_cst) volatile noexcept;
48
+ constexpr T* fetch_max(T*, memory_order = memory_order::seq_cst) noexcept;
49
+ T* fetch_min(T*, memory_order = memory_order::seq_cst) volatile noexcept;
50
+ constexpr T* fetch_min(T*, memory_order = memory_order::seq_cst) noexcept;
51
+
52
+ void store_add(ptrdiff_t, memory_order = memory_order::seq_cst) volatile noexcept;
53
+ constexpr void store_add(ptrdiff_t, memory_order = memory_order::seq_cst) noexcept;
54
+ void store_sub(ptrdiff_t, memory_order = memory_order::seq_cst) volatile noexcept;
55
+ constexpr void store_sub(ptrdiff_t, memory_order = memory_order::seq_cst) noexcept;
56
+ void store_max(T*, memory_order = memory_order::seq_cst) volatile noexcept;
57
+ constexpr void store_max(T*, memory_order = memory_order::seq_cst) noexcept;
58
+ void store_min(T*, memory_order = memory_order::seq_cst) volatile noexcept;
59
+ constexpr void store_min(T*, memory_order = memory_order::seq_cst) noexcept;
60
 
61
  T* operator++(int) volatile noexcept;
62
+ constexpr T* operator++(int) noexcept;
63
  T* operator--(int) volatile noexcept;
64
+ constexpr T* operator--(int) noexcept;
65
  T* operator++() volatile noexcept;
66
+ constexpr T* operator++() noexcept;
67
  T* operator--() volatile noexcept;
68
+ constexpr T* operator--() noexcept;
69
  T* operator+=(ptrdiff_t) volatile noexcept;
70
+ constexpr T* operator+=(ptrdiff_t) noexcept;
71
  T* operator-=(ptrdiff_t) volatile noexcept;
72
+ constexpr T* operator-=(ptrdiff_t) noexcept;
73
 
74
  void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept;
75
+ constexpr void wait(T*, memory_order = memory_order::seq_cst) const noexcept;
76
  void notify_one() volatile noexcept;
77
+ constexpr void notify_one() noexcept;
78
  void notify_all() volatile noexcept;
79
+ constexpr void notify_all() noexcept;
80
  };
81
  }
82
  ```
83
 
84
  There is a partial specialization of the `atomic` class template for
 
95
  **Table: Atomic pointer computations** <a id="atomic.types.pointer.comp">[atomic.types.pointer.comp]</a>
96
 
97
  | | | | | | |
98
  | ----- | --- | -------- | ----- | --- | ----------- |
99
  | `add` | `+` | addition | `sub` | `-` | subtraction |
100
+ | `max` | | maximum | `min` | | minimum |
101
 
102
  ``` cpp
103
+ T* fetch_key(\seeabovenc operand, memory_order order = memory_order::seq_cst) volatile noexcept;
104
+ constexpr T* fetch_key(\seeabovenc operand, memory_order order = memory_order::seq_cst) noexcept;
105
  ```
106
 
107
  *Constraints:* For the `volatile` overload of this function,
108
  `is_always_lock_free` is `true`.
109
 
 
122
  the effects.
123
 
124
  *Remarks:* The result may be an undefined address, but the operations
125
  otherwise have no undefined behavior.
126
 
127
+ For `fetch_max` and `fetch_min`, the maximum and minimum computation is
128
+ performed as if by `max` and `min` algorithms [[alg.min.max]],
129
+ respectively, with the object value and the first parameter as the
130
+ arguments.
131
+
132
+ [*Note 2*: If the pointers point to different complete objects (or
133
+ subobjects thereof), the `<` operator does not establish a strict weak
134
+ ordering ([[cpp17.lessthancomparable]], [[expr.rel]]). — *end note*]
135
+
136
+ ``` cpp
137
+ void store_key(\seeabovenc operand, memory_order order = memory_order::seq_cst) volatile noexcept;
138
+ constexpr void store_key(\seeabovenc operand, memory_order order = memory_order::seq_cst) noexcept;
139
+ ```
140
+
141
+ *Constraints:* For the `volatile` overload of this function,
142
+ `is_always_lock_free` is `true`.
143
+
144
+ *Mandates:* `T` is a complete object type.
145
+
146
+ [*Note 3*: Pointer arithmetic on `void*` or function pointers is
147
+ ill-formed. — *end note*]
148
+
149
+ *Effects:* Atomically replaces the value pointed to by `this` with the
150
+ result of the computation applied to the value pointed to by `this` and
151
+ the given `operand`. Memory is affected according to the value of
152
+ `order`. These operations are atomic modify-write
153
+ operations [[atomics.order]].
154
+
155
+ *Remarks:* The result may be an undefined address, but the operations
156
+ otherwise have no undefined behavior. For `store_max` and `store_min`,
157
+ the maximum and minimum computation is performed as if by `max` and
158
+ `min` algorithms [[alg.min.max]], respectively, with the value pointed
159
+ to by `this` and the first parameter as the arguments.
160
+
161
+ [*Note 4*: If the pointers point to different complete objects (or
162
+ subobjects thereof), the `<` operator does not establish a strict weak
163
+ ordering ([[cpp17.lessthancomparable]], [[expr.rel]]). — *end note*]
164
+
165
  ``` cpp
166
  T* operator op=(ptrdiff_t operand) volatile noexcept;
167
+ constexpr T* operator op=(ptrdiff_t operand) noexcept;
168
  ```
169
 
170
  *Constraints:* For the `volatile` overload of this function,
171
  `is_always_lock_free` is `true`.
172