tmp/tmppvaqva9m/{from.md → to.md}
RENAMED
|
@@ -1,95 +1,107 @@
|
|
| 1 |
-
### Specializations for integers <a id="atomics.types.int">[[atomics.types.int]]</a>
|
| 2 |
|
| 3 |
There are specializations of the `atomic` class template for the
|
| 4 |
integral types `char`, `signed char`, `unsigned char`, `short`,
|
| 5 |
`unsigned short`, `int`, `unsigned int`, `long`, `unsigned long`,
|
| 6 |
`long long`, `unsigned long long`, `char8_t`, `char16_t`, `char32_t`,
|
| 7 |
`wchar_t`, and any other types needed by the typedefs in the header
|
| 8 |
-
`<cstdint>`. For each such type `integral`, the specialization
|
| 9 |
-
`atomic<integral>` provides additional atomic operations
|
| 10 |
-
integral types.
|
| 11 |
|
| 12 |
[*Note 1*: The specialization `atomic<bool>` uses the primary template
|
| 13 |
[[atomics.types.generic]]. — *end note*]
|
| 14 |
|
| 15 |
``` cpp
|
| 16 |
namespace std {
|
| 17 |
-
template<> struct atomic<integral> {
|
| 18 |
-
using value_type = integral;
|
| 19 |
using difference_type = value_type;
|
| 20 |
|
| 21 |
static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic type's operations are always lock free;
|
| 22 |
bool is_lock_free() const volatile noexcept;
|
| 23 |
bool is_lock_free() const noexcept;
|
| 24 |
|
| 25 |
constexpr atomic() noexcept;
|
| 26 |
-
constexpr atomic(integral) noexcept;
|
| 27 |
atomic(const atomic&) = delete;
|
| 28 |
atomic& operator=(const atomic&) = delete;
|
| 29 |
atomic& operator=(const atomic&) volatile = delete;
|
| 30 |
|
| 31 |
-
void store(integral, memory_order = memory_order::seq_cst) volatile noexcept;
|
| 32 |
-
void store(integral, memory_order = memory_order::seq_cst) noexcept;
|
| 33 |
-
integral operator=(integral) volatile noexcept;
|
| 34 |
-
integral operator=(integral) noexcept;
|
| 35 |
-
integral load(memory_order = memory_order::seq_cst) const volatile noexcept;
|
| 36 |
-
integral load(memory_order = memory_order::seq_cst) const noexcept;
|
| 37 |
-
operator integral() const volatile noexcept;
|
| 38 |
-
operator integral() const noexcept;
|
| 39 |
|
| 40 |
-
integral exchange(integral,
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
| 43 |
memory_order, memory_order) volatile noexcept;
|
| 44 |
-
bool compare_exchange_weak(integral&, integral,
|
| 45 |
memory_order, memory_order) noexcept;
|
| 46 |
-
bool compare_exchange_strong(integral&, integral,
|
| 47 |
memory_order, memory_order) volatile noexcept;
|
| 48 |
-
bool compare_exchange_strong(integral&, integral,
|
| 49 |
memory_order, memory_order) noexcept;
|
| 50 |
-
bool compare_exchange_weak(integral&, integral,
|
| 51 |
memory_order = memory_order::seq_cst) volatile noexcept;
|
| 52 |
-
bool compare_exchange_weak(integral&, integral,
|
| 53 |
memory_order = memory_order::seq_cst) noexcept;
|
| 54 |
-
bool compare_exchange_strong(integral&, integral,
|
| 55 |
memory_order = memory_order::seq_cst) volatile noexcept;
|
| 56 |
-
bool compare_exchange_strong(integral&, integral,
|
| 57 |
memory_order = memory_order::seq_cst) noexcept;
|
| 58 |
|
| 59 |
-
integral fetch_add(integral,
|
| 60 |
-
|
| 61 |
-
integral
|
| 62 |
-
|
| 63 |
-
integral
|
| 64 |
-
|
| 65 |
-
integral
|
| 66 |
-
|
| 67 |
-
integral
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
integral operator++(int) volatile noexcept;
|
| 71 |
-
integral operator++(int) noexcept;
|
| 72 |
-
integral operator--(int) volatile noexcept;
|
| 73 |
-
integral operator--(int) noexcept;
|
| 74 |
-
integral operator++() volatile noexcept;
|
| 75 |
-
integral operator++() noexcept;
|
| 76 |
-
integral operator--() volatile noexcept;
|
| 77 |
-
integral operator--() noexcept;
|
| 78 |
-
integral operator+=(integral) volatile noexcept;
|
| 79 |
-
integral operator+=(integral) noexcept;
|
| 80 |
-
integral operator-=(integral) volatile noexcept;
|
| 81 |
-
integral operator-=(integral) noexcept;
|
| 82 |
-
integral operator&=(integral) volatile noexcept;
|
| 83 |
-
integral operator&=(integral) noexcept;
|
| 84 |
-
integral operator|=(integral) volatile noexcept;
|
| 85 |
-
integral operator|=(integral) noexcept;
|
| 86 |
-
integral operator^=(integral) volatile noexcept;
|
| 87 |
-
integral operator^=(integral) noexcept;
|
| 88 |
|
| 89 |
-
void wait(integral, memory_order = memory_order::seq_cst) const volatile noexcept;
|
| 90 |
-
void wait(integral, memory_order = memory_order::seq_cst) const noexcept;
|
| 91 |
void notify_one() volatile noexcept;
|
| 92 |
void notify_one() noexcept;
|
| 93 |
void notify_all() volatile noexcept;
|
| 94 |
void notify_all() noexcept;
|
| 95 |
};
|
|
@@ -100,12 +112,13 @@ The atomic integral specializations are standard-layout structs. They
|
|
| 100 |
each have a trivial destructor.
|
| 101 |
|
| 102 |
Descriptions are provided below only for members that differ from the
|
| 103 |
primary template.
|
| 104 |
|
| 105 |
-
The following operations perform arithmetic computations. The
|
| 106 |
-
operator, and computation
|
|
|
|
| 107 |
|
| 108 |
**Table: Atomic arithmetic computations** <a id="atomic.types.int.comp">[atomic.types.int.comp]</a>
|
| 109 |
|
| 110 |
| | | | | | |
|
| 111 |
| ----- | --- | -------------------- | ----- | --- | -------------------- |
|
|
|
|
| 1 |
+
#### Specializations for integers <a id="atomics.types.int">[[atomics.types.int]]</a>
|
| 2 |
|
| 3 |
There are specializations of the `atomic` class template for the
|
| 4 |
integral types `char`, `signed char`, `unsigned char`, `short`,
|
| 5 |
`unsigned short`, `int`, `unsigned int`, `long`, `unsigned long`,
|
| 6 |
`long long`, `unsigned long long`, `char8_t`, `char16_t`, `char32_t`,
|
| 7 |
`wchar_t`, and any other types needed by the typedefs in the header
|
| 8 |
+
`<cstdint>`. For each such type `integral-type`, the specialization
|
| 9 |
+
`atomic<integral-type>` provides additional atomic operations
|
| 10 |
+
appropriate to integral types.
|
| 11 |
|
| 12 |
[*Note 1*: The specialization `atomic<bool>` uses the primary template
|
| 13 |
[[atomics.types.generic]]. — *end note*]
|
| 14 |
|
| 15 |
``` cpp
|
| 16 |
namespace std {
|
| 17 |
+
template<> struct atomic<integral-type> {
|
| 18 |
+
using value_type = integral-type;
|
| 19 |
using difference_type = value_type;
|
| 20 |
|
| 21 |
static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic type's operations are always lock free;
|
| 22 |
bool is_lock_free() const volatile noexcept;
|
| 23 |
bool is_lock_free() const noexcept;
|
| 24 |
|
| 25 |
constexpr atomic() noexcept;
|
| 26 |
+
constexpr atomic(integral-type) noexcept;
|
| 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 |
};
|
|
|
|
| 112 |
each have a trivial destructor.
|
| 113 |
|
| 114 |
Descriptions are provided below only for members that differ from the
|
| 115 |
primary template.
|
| 116 |
|
| 117 |
+
The following operations perform arithmetic computations. The
|
| 118 |
+
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 |
| ----- | --- | -------------------- | ----- | --- | -------------------- |
|