From Jason Turner

[utility.swap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0tjhf9q2/{from.md → to.md} +15 -9
tmp/tmp0tjhf9q2/{from.md → to.md} RENAMED
@@ -1,29 +1,35 @@
1
- ### swap <a id="utility.swap">[[utility.swap]]</a>
2
 
3
  ``` cpp
4
- template<class T> void swap(T& a, T& b) noexcept(see below);
 
5
  ```
6
 
7
- The expression inside `noexcept` is equivalent to:
 
 
 
8
 
9
  ``` cpp
10
- is_nothrow_move_constructible<T>::value &&
11
- is_nothrow_move_assignable<T>::value
12
  ```
13
 
14
  *Requires:* Type `T` shall be `MoveConstructible`
15
- (Table  [[moveconstructible]]) and `MoveAssignable`
16
- (Table  [[moveassignable]]).
17
 
18
  *Effects:* Exchanges values stored in two locations.
19
 
20
  ``` cpp
21
  template <class T, size_t N>
22
- void swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));
23
  ```
24
 
 
 
 
25
  *Requires:* `a[i]` shall be swappable with ([[swappable.requirements]])
26
  `b[i]` for all `i` in the range \[`0`, `N`).
27
 
28
- *Effects:* `swap_ranges(a, a + N, b)`
29
 
 
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