tmp/tmpe3_lfaz9/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Partial specialization for pointers <a id="atomics.ref.pointer">[[atomics.ref.pointer]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
template<class T> struct atomic_ref<T*> {
|
| 6 |
+
private:
|
| 7 |
+
T** ptr; // exposition only
|
| 8 |
+
public:
|
| 9 |
+
using value_type = T*;
|
| 10 |
+
using difference_type = ptrdiff_t;
|
| 11 |
+
static constexpr size_t required_alignment = implementation-defined // required alignment for atomic_ref type's operations;
|
| 12 |
+
|
| 13 |
+
static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic_ref type's operations are always lock free;
|
| 14 |
+
bool is_lock_free() const noexcept;
|
| 15 |
+
|
| 16 |
+
explicit atomic_ref(T*&);
|
| 17 |
+
atomic_ref(const atomic_ref&) noexcept;
|
| 18 |
+
atomic_ref& operator=(const atomic_ref&) = delete;
|
| 19 |
+
|
| 20 |
+
void store(T*, memory_order = memory_order::seq_cst) const noexcept;
|
| 21 |
+
T* operator=(T*) const noexcept;
|
| 22 |
+
T* load(memory_order = memory_order::seq_cst) const noexcept;
|
| 23 |
+
operator T*() const noexcept;
|
| 24 |
+
|
| 25 |
+
T* exchange(T*, memory_order = memory_order::seq_cst) const noexcept;
|
| 26 |
+
bool compare_exchange_weak(T*&, T*,
|
| 27 |
+
memory_order, memory_order) const noexcept;
|
| 28 |
+
bool compare_exchange_strong(T*&, T*,
|
| 29 |
+
memory_order, memory_order) const noexcept;
|
| 30 |
+
bool compare_exchange_weak(T*&, T*,
|
| 31 |
+
memory_order = memory_order::seq_cst) const noexcept;
|
| 32 |
+
bool compare_exchange_strong(T*&, T*,
|
| 33 |
+
memory_order = memory_order::seq_cst) const noexcept;
|
| 34 |
+
|
| 35 |
+
T* fetch_add(difference_type, memory_order = memory_order::seq_cst) const noexcept;
|
| 36 |
+
T* fetch_sub(difference_type, memory_order = memory_order::seq_cst) const noexcept;
|
| 37 |
+
|
| 38 |
+
T* operator++(int) const noexcept;
|
| 39 |
+
T* operator--(int) const noexcept;
|
| 40 |
+
T* operator++() const noexcept;
|
| 41 |
+
T* operator--() const noexcept;
|
| 42 |
+
T* operator+=(difference_type) const noexcept;
|
| 43 |
+
T* operator-=(difference_type) const noexcept;
|
| 44 |
+
|
| 45 |
+
void wait(T*, memory_order = memory_order::seq_cst) const noexcept;
|
| 46 |
+
void notify_one() const noexcept;
|
| 47 |
+
void notify_all() const noexcept;
|
| 48 |
+
};
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Descriptions are provided below only for members that differ from the
|
| 53 |
+
primary template.
|
| 54 |
+
|
| 55 |
+
The following operations perform arithmetic computations. The key,
|
| 56 |
+
operator, and computation correspondence is identified in
|
| 57 |
+
[[atomic.types.pointer.comp]].
|
| 58 |
+
|
| 59 |
+
``` cpp
|
| 60 |
+
T* fetch_key(difference_type operand, memory_order order = memory_order::seq_cst) const noexcept;
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
*Mandates:* `T` is a complete object type.
|
| 64 |
+
|
| 65 |
+
*Effects:* Atomically replaces the value referenced by `*ptr` with the
|
| 66 |
+
result of the computation applied to the value referenced by `*ptr` and
|
| 67 |
+
the given operand. Memory is affected according to the value of `order`.
|
| 68 |
+
These operations are atomic read-modify-write
|
| 69 |
+
operations [[intro.races]].
|
| 70 |
+
|
| 71 |
+
*Returns:* Atomically, the value referenced by `*ptr` immediately before
|
| 72 |
+
the effects.
|
| 73 |
+
|
| 74 |
+
*Remarks:* The result may be an undefined address, but the operations
|
| 75 |
+
otherwise have no undefined behavior.
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
T* operator op=(difference_type operand) const noexcept;
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
*Effects:* Equivalent to:
|
| 82 |
+
`return fetch_`*`key`*`(operand) `*`op`*` operand;`
|
| 83 |
+
|