From Jason Turner

[variant.assign]

Diff to HTML by rtfpessoa

tmp/tmpog4xsqw2/{from.md → to.md} RENAMED
@@ -16,14 +16,14 @@ Let j be `rhs.index()`.
16
  - Otherwise, if either `is_nothrow_copy_constructible_v<``Tⱼ``>` is
17
  `true` or `is_nothrow_move_constructible_v<``Tⱼ``>` is `false`,
18
  equivalent to `emplace<`j`>(get<`j`>(rhs))`.
19
  - Otherwise, equivalent to `operator=(variant(rhs))`.
20
 
21
- *Returns:* `*this`.
22
-
23
  *Ensures:* `index() == rhs.index()`.
24
 
 
 
25
  *Remarks:* This operator is defined as deleted unless
26
  `is_copy_constructible_v<``Tᵢ``> &&` `is_copy_assignable_v<``Tᵢ``>` is
27
  `true` for all i. If `is_trivially_copy_constructible_v<``Tᵢ``> &&`
28
  `is_trivially_copy_assignable_v<``Tᵢ``> &&`
29
  `is_trivially_destructible_v<``Tᵢ``>` is `true` for all i, this
@@ -50,23 +50,23 @@ Let j be `rhs.index()`.
50
  *Returns:* `*this`.
51
 
52
  *Remarks:* If `is_trivially_move_constructible_v<``Tᵢ``> &&`
53
  `is_trivially_move_assignable_v<``Tᵢ``> &&`
54
  `is_trivially_destructible_v<``Tᵢ``>` is `true` for all i, this
55
- assignment operator is trivial. The expression inside `noexcept` is
56
- equivalent to:
57
  `is_nothrow_move_constructible_v<``Tᵢ``> && is_nothrow_move_assignable_v<``Tᵢ``>`
58
  for all i.
59
 
60
  - If an exception is thrown during the call to `Tⱼ`’s move construction
61
  (with j being `rhs.index()`), the `variant` will hold no value.
62
  - If an exception is thrown during the call to `Tⱼ`’s move assignment,
63
  the state of the contained value is as defined by the exception safety
64
  guarantee of `Tⱼ`’s move assignment; `index()` will be j.
65
 
66
  ``` cpp
67
- template<class T> variant& operator=(T&& t) noexcept(see below);
68
  ```
69
 
70
  Let `Tⱼ` be a type that is determined as follows: build an imaginary
71
  function *FUN*(Tᵢ) for each alternative type `Tᵢ` for which `Tᵢ`` x[] =`
72
  `{std::forward<T>(t)};` is well-formed for some invented variable `x`.
@@ -94,18 +94,18 @@ which is the type of the contained value after assignment.
94
  - If `*this` holds a `Tⱼ`, assigns `std::forward<T>(t)` to the value
95
  contained in `*this`.
96
  - Otherwise, if `is_nothrow_constructible_v<``Tⱼ``, T> ||`
97
  `!is_nothrow_move_constructible_v<``Tⱼ``>` is `true`, equivalent to
98
  `emplace<`j`>(std::forward<T>(t))`.
99
- - Otherwise, equivalent to `operator=(variant(std::forward<T>(t)))`.
100
 
101
  *Ensures:* `holds_alternative<``Tⱼ``>(*this)` is `true`, with `Tⱼ`
102
  selected by the imaginary function overload resolution described above.
103
 
104
  *Returns:* `*this`.
105
 
106
- *Remarks:* The expression inside `noexcept` is equivalent to:
107
 
108
  ``` cpp
109
  is_nothrow_assignable_v<Tⱼ&, T> && is_nothrow_constructible_v<Tⱼ, T>
110
  ```
111
 
@@ -113,7 +113,7 @@ is_nothrow_assignable_v<Tⱼ&, T> && is_nothrow_constructible_v<Tⱼ, T>
113
  `std::forward<T>(t)` to the value contained in `*this`, the state of
114
  the contained value and `t` are as defined by the exception safety
115
  guarantee of the assignment expression; `valueless_by_exception()`
116
  will be `false`.
117
  - If an exception is thrown during the initialization of the contained
118
- value, the `variant` object might not hold a value.
119
 
 
16
  - Otherwise, if either `is_nothrow_copy_constructible_v<``Tⱼ``>` is
17
  `true` or `is_nothrow_move_constructible_v<``Tⱼ``>` is `false`,
18
  equivalent to `emplace<`j`>(get<`j`>(rhs))`.
19
  - Otherwise, equivalent to `operator=(variant(rhs))`.
20
 
 
 
21
  *Ensures:* `index() == rhs.index()`.
22
 
23
+ *Returns:* `*this`.
24
+
25
  *Remarks:* This operator is defined as deleted unless
26
  `is_copy_constructible_v<``Tᵢ``> &&` `is_copy_assignable_v<``Tᵢ``>` is
27
  `true` for all i. If `is_trivially_copy_constructible_v<``Tᵢ``> &&`
28
  `is_trivially_copy_assignable_v<``Tᵢ``> &&`
29
  `is_trivially_destructible_v<``Tᵢ``>` is `true` for all i, this
 
50
  *Returns:* `*this`.
51
 
52
  *Remarks:* If `is_trivially_move_constructible_v<``Tᵢ``> &&`
53
  `is_trivially_move_assignable_v<``Tᵢ``> &&`
54
  `is_trivially_destructible_v<``Tᵢ``>` is `true` for all i, this
55
+ assignment operator is trivial. The exception specification is
56
+ equivalent to
57
  `is_nothrow_move_constructible_v<``Tᵢ``> && is_nothrow_move_assignable_v<``Tᵢ``>`
58
  for all i.
59
 
60
  - If an exception is thrown during the call to `Tⱼ`’s move construction
61
  (with j being `rhs.index()`), the `variant` will hold no value.
62
  - If an exception is thrown during the call to `Tⱼ`’s move assignment,
63
  the state of the contained value is as defined by the exception safety
64
  guarantee of `Tⱼ`’s move assignment; `index()` will be j.
65
 
66
  ``` cpp
67
+ template<class T> constexpr variant& operator=(T&& t) noexcept(see below);
68
  ```
69
 
70
  Let `Tⱼ` be a type that is determined as follows: build an imaginary
71
  function *FUN*(Tᵢ) for each alternative type `Tᵢ` for which `Tᵢ`` x[] =`
72
  `{std::forward<T>(t)};` is well-formed for some invented variable `x`.
 
94
  - If `*this` holds a `Tⱼ`, assigns `std::forward<T>(t)` to the value
95
  contained in `*this`.
96
  - Otherwise, if `is_nothrow_constructible_v<``Tⱼ``, T> ||`
97
  `!is_nothrow_move_constructible_v<``Tⱼ``>` is `true`, equivalent to
98
  `emplace<`j`>(std::forward<T>(t))`.
99
+ - Otherwise, equivalent to `emplace<`j`>(``Tⱼ``(std::forward<T>(t)))`.
100
 
101
  *Ensures:* `holds_alternative<``Tⱼ``>(*this)` is `true`, with `Tⱼ`
102
  selected by the imaginary function overload resolution described above.
103
 
104
  *Returns:* `*this`.
105
 
106
+ *Remarks:* The exception specification is equivalent to:
107
 
108
  ``` cpp
109
  is_nothrow_assignable_v<Tⱼ&, T> && is_nothrow_constructible_v<Tⱼ, T>
110
  ```
111
 
 
113
  `std::forward<T>(t)` to the value contained in `*this`, the state of
114
  the contained value and `t` are as defined by the exception safety
115
  guarantee of the assignment expression; `valueless_by_exception()`
116
  will be `false`.
117
  - If an exception is thrown during the initialization of the contained
118
+ value, the `variant` object is permitted to not hold a value.
119