From Jason Turner

[atomics.ref.float]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpgvps4tk6/{from.md → to.md} +31 -30
tmp/tmpgvps4tk6/{from.md → to.md} RENAMED
@@ -1,70 +1,71 @@
1
- ### Specializations for floating-point types <a id="atomics.ref.float">[[atomics.ref.float]]</a>
2
 
3
- There are specializations of the `atomic_ref` class template for the
4
- floating-point types `float`, `double`, and `long double`. For each such
5
- type `floating-point`, the specialization `atomic_ref<floating-point>`
6
  provides additional atomic operations appropriate to floating-point
7
  types.
8
 
9
  ``` cpp
10
  namespace std {
11
- template<> struct atomic_ref<floating-point> {
12
  private:
13
- floating-point* ptr; // exposition only
 
14
  public:
15
- using value_type = floating-point;
16
  using difference_type = value_type;
17
  static constexpr size_t required_alignment = implementation-defined // required alignment for atomic_ref type's operations;
18
 
19
  static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic_ref type's operations are always lock free;
20
  bool is_lock_free() const noexcept;
21
 
22
- explicit atomic_ref(floating-point&);
23
  atomic_ref(const atomic_ref&) noexcept;
24
  atomic_ref& operator=(const atomic_ref&) = delete;
25
 
26
- void store(floating-point, memory_order = memory_order::seq_cst) const noexcept;
27
- floating-point operator=(floating-point) const noexcept;
28
- floating-point load(memory_order = memory_order::seq_cst) const noexcept;
29
- operator floating-point() const noexcept;
30
 
31
- floating-point exchange(floating-point,
32
  memory_order = memory_order::seq_cst) const noexcept;
33
- bool compare_exchange_weak(floating-point&, floating-point,
34
  memory_order, memory_order) const noexcept;
35
- bool compare_exchange_strong(floating-point&, floating-point,
36
  memory_order, memory_order) const noexcept;
37
- bool compare_exchange_weak(floating-point&, floating-point,
38
  memory_order = memory_order::seq_cst) const noexcept;
39
- bool compare_exchange_strong(floating-point&, floating-point,
40
  memory_order = memory_order::seq_cst) const noexcept;
41
 
42
- floating-point fetch_add(floating-point,
43
  memory_order = memory_order::seq_cst) const noexcept;
44
- floating-point fetch_sub(floating-point,
45
  memory_order = memory_order::seq_cst) const noexcept;
46
 
47
- floating-point operator+=(floating-point) const noexcept;
48
- floating-point operator-=(floating-point) const noexcept;
49
 
50
- void wait(floating-point, memory_order = memory_order::seq_cst) const noexcept;
51
  void notify_one() const noexcept;
52
  void notify_all() const noexcept;
53
  };
54
  }
55
  ```
56
 
57
  Descriptions are provided below only for members that differ from the
58
  primary template.
59
 
60
- The following operations perform arithmetic computations. The key,
61
- operator, and computation correspondence are identified in
62
  [[atomic.types.int.comp]].
63
 
64
  ``` cpp
65
- floating-point fetch_key(floating-point operand,
66
  memory_order order = memory_order::seq_cst) const noexcept;
67
  ```
68
 
69
  *Effects:* Atomically replaces the value referenced by `*ptr` with the
70
  result of the computation applied to the value referenced by `*ptr` and
@@ -76,19 +77,19 @@ operations [[intro.races]].
76
  the effects.
77
 
78
  *Remarks:* If the result is not a representable value for its
79
  type [[expr.pre]], the result is unspecified, but the operations
80
  otherwise have no undefined behavior. Atomic arithmetic operations on
81
- *`floating-point`* should conform to the
82
- `std::numeric_limits<`*`floating-point`*`>` traits associated with the
83
- floating-point type [[limits.syn]]. The floating-point
84
  environment [[cfenv]] for atomic arithmetic operations on
85
- *`floating-point`* may be different than the calling thread’s
86
  floating-point environment.
87
 
88
  ``` cpp
89
- floating-point operator op=(floating-point operand) const noexcept;
90
  ```
91
 
92
  *Effects:* Equivalent to:
93
  `return fetch_`*`key`*`(operand) `*`op`*` operand;`
94
 
 
1
+ #### Specializations for floating-point types <a id="atomics.ref.float">[[atomics.ref.float]]</a>
2
 
3
+ There are specializations of the `atomic_ref` class template for all
4
+ cv-unqualified floating-point types. For each such type
5
+ `floating-point-type`, the specialization `atomic_ref<floating-point>`
6
  provides additional atomic operations appropriate to floating-point
7
  types.
8
 
9
  ``` cpp
10
  namespace std {
11
+ template<> struct atomic_ref<floating-point-type> {
12
  private:
13
+ floating-point-type* ptr; // exposition only
14
+
15
  public:
16
+ using value_type = floating-point-type;
17
  using difference_type = value_type;
18
  static constexpr size_t required_alignment = implementation-defined // required alignment for atomic_ref type's operations;
19
 
20
  static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic_ref type's operations are always lock free;
21
  bool is_lock_free() const noexcept;
22
 
23
+ explicit atomic_ref(floating-point-type&);
24
  atomic_ref(const atomic_ref&) noexcept;
25
  atomic_ref& operator=(const atomic_ref&) = delete;
26
 
27
+ void store(floating-point-type, memory_order = memory_order::seq_cst) const noexcept;
28
+ floating-point-type operator=(floating-point-type) const noexcept;
29
+ floating-point-type load(memory_order = memory_order::seq_cst) const noexcept;
30
+ operator floating-point-type() const noexcept;
31
 
32
+ floating-point-type exchange(floating-point-type,
33
  memory_order = memory_order::seq_cst) const noexcept;
34
+ bool compare_exchange_weak(floating-point-type&, floating-point-type,
35
  memory_order, memory_order) const noexcept;
36
+ bool compare_exchange_strong(floating-point-type&, floating-point-type,
37
  memory_order, memory_order) const noexcept;
38
+ bool compare_exchange_weak(floating-point-type&, floating-point-type,
39
  memory_order = memory_order::seq_cst) const noexcept;
40
+ bool compare_exchange_strong(floating-point-type&, floating-point-type,
41
  memory_order = memory_order::seq_cst) const noexcept;
42
 
43
+ floating-point-type fetch_add(floating-point-type,
44
  memory_order = memory_order::seq_cst) const noexcept;
45
+ floating-point-type fetch_sub(floating-point-type,
46
  memory_order = memory_order::seq_cst) const noexcept;
47
 
48
+ floating-point-type operator+=(floating-point-type) const noexcept;
49
+ floating-point-type operator-=(floating-point-type) const noexcept;
50
 
51
+ void wait(floating-point-type, memory_order = memory_order::seq_cst) const noexcept;
52
  void notify_one() const noexcept;
53
  void notify_all() const noexcept;
54
  };
55
  }
56
  ```
57
 
58
  Descriptions are provided below only for members that differ from the
59
  primary template.
60
 
61
+ The following operations perform arithmetic computations. The
62
+ correspondence among key, operator, and computation is specified in
63
  [[atomic.types.int.comp]].
64
 
65
  ``` cpp
66
+ floating-point-type fetch_key(floating-point-type operand,
67
  memory_order order = memory_order::seq_cst) const noexcept;
68
  ```
69
 
70
  *Effects:* Atomically replaces the value referenced by `*ptr` with the
71
  result of the computation applied to the value referenced by `*ptr` and
 
77
  the effects.
78
 
79
  *Remarks:* If the result is not a representable value for its
80
  type [[expr.pre]], the result is unspecified, but the operations
81
  otherwise have no undefined behavior. Atomic arithmetic operations on
82
+ *`floating-point-type`* should conform to the
83
+ `std::numeric_limits<`*`floating-point-type`*`>` traits associated with
84
+ the floating-point type [[limits.syn]]. The floating-point
85
  environment [[cfenv]] for atomic arithmetic operations on
86
+ *`floating-point-type`* may be different than the calling thread’s
87
  floating-point environment.
88
 
89
  ``` cpp
90
+ floating-point-type operator op=(floating-point-type operand) const noexcept;
91
  ```
92
 
93
  *Effects:* Equivalent to:
94
  `return fetch_`*`key`*`(operand) `*`op`*` operand;`
95