From Jason Turner

[optional.swap]

Diff to HTML by rtfpessoa

tmp/tmp2rwamxw8/{from.md → to.md} RENAMED
@@ -2,25 +2,26 @@
2
 
3
  ``` cpp
4
  void swap(optional& rhs) noexcept(see below);
5
  ```
6
 
7
- *Requires:* Lvalues of type `T` shall be swappable and
8
- `is_move_constructible_v<T>` is `true`.
9
 
10
- *Effects:* See Table  [[tab:optional.swap]].
11
 
12
- **Table: `optional::swap(optional&)` effects** <a id="tab:optional.swap">[tab:optional.swap]</a>
 
 
13
 
14
  | | `*this` contains a value | `*this` does not contain a value |
15
  | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
16
  | `rhs` contains a value | calls `swap(*(*this), *rhs)` | initializes the contained value of `*this` as if direct-non-list-initializing an object of type `T` with the expression `std::move(*rhs)`, followed by `rhs.val->T::~T()`; postcondition is that `*this` contains a value and `rhs` does not contain a value |
17
  | `rhs` does not contain a value | initializes the contained value of `rhs` as if direct-non-list-initializing an object of type `T` with the expression `std::move(*(*this))`, followed by `val->T::~T()`; postcondition is that `*this` does not contain a value and `rhs` contains a value | no effect |
18
 
19
 
20
  *Throws:* Any exceptions thrown by the operations in the relevant part
21
- of Table  [[tab:optional.swap]].
22
 
23
  *Remarks:* The expression inside `noexcept` is equivalent to:
24
 
25
  ``` cpp
26
  is_nothrow_move_constructible_v<T> && is_nothrow_swappable_v<T>
 
2
 
3
  ``` cpp
4
  void swap(optional& rhs) noexcept(see below);
5
  ```
6
 
7
+ *Mandates:* `is_move_constructible_v<T>` is `true`.
 
8
 
9
+ *Preconditions:* Lvalues of type `T` are swappable.
10
 
11
+ *Effects:* See [[optional.swap]].
12
+
13
+ **Table: `optional::swap(optional&)` effects** <a id="optional.swap">[optional.swap]</a>
14
 
15
  | | `*this` contains a value | `*this` does not contain a value |
16
  | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
17
  | `rhs` contains a value | calls `swap(*(*this), *rhs)` | initializes the contained value of `*this` as if direct-non-list-initializing an object of type `T` with the expression `std::move(*rhs)`, followed by `rhs.val->T::~T()`; postcondition is that `*this` contains a value and `rhs` does not contain a value |
18
  | `rhs` does not contain a value | initializes the contained value of `rhs` as if direct-non-list-initializing an object of type `T` with the expression `std::move(*(*this))`, followed by `val->T::~T()`; postcondition is that `*this` does not contain a value and `rhs` contains a value | no effect |
19
 
20
 
21
  *Throws:* Any exceptions thrown by the operations in the relevant part
22
+ of [[optional.swap]].
23
 
24
  *Remarks:* The expression inside `noexcept` is equivalent to:
25
 
26
  ``` cpp
27
  is_nothrow_move_constructible_v<T> && is_nothrow_swappable_v<T>