From Jason Turner

[utility.swap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpx4z6ldan/{from.md → to.md} +17 -16
tmp/tmpx4z6ldan/{from.md → to.md} RENAMED
@@ -1,35 +1,36 @@
1
  ### `swap` <a id="utility.swap">[[utility.swap]]</a>
2
 
3
  ``` cpp
4
  template<class T>
5
- void swap(T& a, T& b) noexcept(see below);
6
  ```
7
 
8
- *Remarks:* This function shall not participate in overload resolution
9
- unless `is_move_constructible_v<T>` is `true` and
10
- `is_move_assignable_v<T>` is `true`. The expression inside `noexcept` is
11
- equivalent to:
12
 
13
- ``` cpp
14
- is_nothrow_move_constructible_v<T> && is_nothrow_move_assignable_v<T>
15
- ```
16
-
17
- *Requires:* Type `T` shall be `MoveConstructible`
18
- (Table  [[tab:moveconstructible]]) and `MoveAssignable`
19
- (Table  [[tab:moveassignable]]).
20
 
21
  *Effects:* Exchanges values stored in two locations.
22
 
 
 
 
 
 
 
 
 
23
  ``` cpp
24
  template<class T, size_t N>
25
- void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
26
  ```
27
 
28
- *Remarks:* This function shall not participate in overload resolution
29
- unless `is_swappable_v<T>` is `true`.
30
 
31
- *Requires:* `a[i]` shall be swappable with ([[swappable.requirements]])
32
  `b[i]` for all `i` in the range \[`0`, `N`).
33
 
34
  *Effects:* As if by `swap_ranges(a, a + N, b)`.
35
 
 
1
  ### `swap` <a id="utility.swap">[[utility.swap]]</a>
2
 
3
  ``` cpp
4
  template<class T>
5
+ constexpr void swap(T& a, T& b) noexcept(see below);
6
  ```
7
 
8
+ *Constraints:* `is_move_constructible_v<T>` is `true` and
9
+ `is_move_assignable_v<T>` is `true`.
 
 
10
 
11
+ *Preconditions:* Type `T` meets the *Cpp17MoveConstructible*
12
+ ([[cpp17.moveconstructible]]) and *Cpp17MoveAssignable*
13
+ ([[cpp17.moveassignable]]) requirements.
 
 
 
 
14
 
15
  *Effects:* Exchanges values stored in two locations.
16
 
17
+ *Remarks:* This function is a designated customization
18
+ point [[namespace.std]]. The expression inside `noexcept` is equivalent
19
+ to:
20
+
21
+ ``` cpp
22
+ is_nothrow_move_constructible_v<T> && is_nothrow_move_assignable_v<T>
23
+ ```
24
+
25
  ``` cpp
26
  template<class T, size_t N>
27
+ constexpr void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
28
  ```
29
 
30
+ *Constraints:* `is_swappable_v<T>` is `true`.
 
31
 
32
+ *Preconditions:* `a[i]` is swappable with [[swappable.requirements]]
33
  `b[i]` for all `i` in the range \[`0`, `N`).
34
 
35
  *Effects:* As if by `swap_ranges(a, a + N, b)`.
36