tmp/tmpeq6494ap/{from.md → to.md}
RENAMED
|
@@ -1,106 +1,106 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class T, class D> void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*
|
| 8 |
-
unless `is_swappable_v<D>` is `true`.
|
| 9 |
|
| 10 |
*Effects:* Calls `x.swap(y)`.
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
template<class T1, class D1, class T2, class D2>
|
| 14 |
bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 15 |
```
|
| 16 |
|
| 17 |
*Returns:* `x.get() == y.get()`.
|
| 18 |
|
| 19 |
-
``` cpp
|
| 20 |
-
template <class T1, class D1, class T2, class D2>
|
| 21 |
-
bool operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 22 |
-
```
|
| 23 |
-
|
| 24 |
-
*Returns:* `x.get() != y.get()`.
|
| 25 |
-
|
| 26 |
``` cpp
|
| 27 |
template<class T1, class D1, class T2, class D2>
|
| 28 |
bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 29 |
```
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
``` cpp
|
| 34 |
common_type_t<typename unique_ptr<T1, D1>::pointer,
|
| 35 |
typename unique_ptr<T2, D2>::pointer>
|
| 36 |
```
|
| 37 |
|
| 38 |
-
|
| 39 |
-
type ([[function.objects]]) that induces a strict weak
|
| 40 |
-
ordering ([[alg.sorting]]) on the pointer values.
|
| 41 |
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
-
*
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
`
|
| 49 |
-
template <class T1, class D1, class T2, class D2>
|
| 50 |
-
bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 51 |
-
```
|
| 52 |
-
|
| 53 |
-
*Returns:* `!(y < x)`.
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
template<class T1, class D1, class T2, class D2>
|
| 57 |
bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 58 |
```
|
| 59 |
|
| 60 |
*Returns:* `y < x`.
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
``` cpp
|
| 63 |
template<class T1, class D1, class T2, class D2>
|
| 64 |
bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 65 |
```
|
| 66 |
|
| 67 |
*Returns:* `!(x < y)`.
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
``` cpp
|
| 70 |
template<class T, class D>
|
| 71 |
bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
|
| 72 |
-
template <class T, class D>
|
| 73 |
-
bool operator==(nullptr_t, const unique_ptr<T, D>& x) noexcept;
|
| 74 |
```
|
| 75 |
|
| 76 |
*Returns:* `!x`.
|
| 77 |
|
| 78 |
-
``` cpp
|
| 79 |
-
template <class T, class D>
|
| 80 |
-
bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept;
|
| 81 |
-
template <class T, class D>
|
| 82 |
-
bool operator!=(nullptr_t, const unique_ptr<T, D>& x) noexcept;
|
| 83 |
-
```
|
| 84 |
-
|
| 85 |
-
*Returns:* `(bool)x`.
|
| 86 |
-
|
| 87 |
``` cpp
|
| 88 |
template<class T, class D>
|
| 89 |
bool operator<(const unique_ptr<T, D>& x, nullptr_t);
|
| 90 |
template<class T, class D>
|
| 91 |
bool operator<(nullptr_t, const unique_ptr<T, D>& x);
|
| 92 |
```
|
| 93 |
|
| 94 |
-
*
|
| 95 |
-
|
| 96 |
-
|
| 97 |
|
| 98 |
*Returns:* The first function template returns
|
| 99 |
-
|
| 100 |
-
`
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
``` cpp
|
| 104 |
template<class T, class D>
|
| 105 |
bool operator>(const unique_ptr<T, D>& x, nullptr_t);
|
| 106 |
template<class T, class D>
|
|
@@ -128,5 +128,14 @@ template <class T, class D>
|
|
| 128 |
```
|
| 129 |
|
| 130 |
*Returns:* The first function template returns `!(x < nullptr)`. The
|
| 131 |
second function template returns `!(nullptr < x)`.
|
| 132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Specialized algorithms <a id="unique.ptr.special">[[unique.ptr.special]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class T, class D> void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
+
*Constraints:* `is_swappable_v<D>` is `true`.
|
|
|
|
| 8 |
|
| 9 |
*Effects:* Calls `x.swap(y)`.
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
template<class T1, class D1, class T2, class D2>
|
| 13 |
bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 14 |
```
|
| 15 |
|
| 16 |
*Returns:* `x.get() == y.get()`.
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
``` cpp
|
| 19 |
template<class T1, class D1, class T2, class D2>
|
| 20 |
bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 21 |
```
|
| 22 |
|
| 23 |
+
Let `CT` denote
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
common_type_t<typename unique_ptr<T1, D1>::pointer,
|
| 27 |
typename unique_ptr<T2, D2>::pointer>
|
| 28 |
```
|
| 29 |
|
| 30 |
+
*Mandates:*
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
- `unique_ptr<T1, D1>::pointer` is implicitly convertible to `CT` and
|
| 33 |
+
- `unique_ptr<T2, D2>::pointer` is implicitly convertible to `CT`.
|
| 34 |
|
| 35 |
+
*Preconditions:* The specialization `less<CT>` is a function object
|
| 36 |
+
type [[function.objects]] that induces a strict weak
|
| 37 |
+
ordering [[alg.sorting]] on the pointer values.
|
| 38 |
|
| 39 |
+
*Returns:* `less<CT>()(x.get(), y.get())`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
template<class T1, class D1, class T2, class D2>
|
| 43 |
bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 44 |
```
|
| 45 |
|
| 46 |
*Returns:* `y < x`.
|
| 47 |
|
| 48 |
+
``` cpp
|
| 49 |
+
template<class T1, class D1, class T2, class D2>
|
| 50 |
+
bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
*Returns:* `!(y < x)`.
|
| 54 |
+
|
| 55 |
``` cpp
|
| 56 |
template<class T1, class D1, class T2, class D2>
|
| 57 |
bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 58 |
```
|
| 59 |
|
| 60 |
*Returns:* `!(x < y)`.
|
| 61 |
|
| 62 |
+
``` cpp
|
| 63 |
+
template<class T1, class D1, class T2, class D2>
|
| 64 |
+
requires three_way_comparable_with<typename unique_ptr<T1, D1>::pointer,
|
| 65 |
+
typename unique_ptr<T2, D2>::pointer>
|
| 66 |
+
compare_three_way_result_t<typename unique_ptr<T1, D1>::pointer,
|
| 67 |
+
typename unique_ptr<T2, D2>::pointer>
|
| 68 |
+
operator<=>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
*Returns:* `compare_three_way()(x.get(), y.get())`.
|
| 72 |
+
|
| 73 |
``` cpp
|
| 74 |
template<class T, class D>
|
| 75 |
bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
|
|
|
|
|
|
|
| 76 |
```
|
| 77 |
|
| 78 |
*Returns:* `!x`.
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
``` cpp
|
| 81 |
template<class T, class D>
|
| 82 |
bool operator<(const unique_ptr<T, D>& x, nullptr_t);
|
| 83 |
template<class T, class D>
|
| 84 |
bool operator<(nullptr_t, const unique_ptr<T, D>& x);
|
| 85 |
```
|
| 86 |
|
| 87 |
+
*Preconditions:* The specialization `less<unique_ptr<T, D>::pointer>` is
|
| 88 |
+
a function object type [[function.objects]] that induces a strict weak
|
| 89 |
+
ordering [[alg.sorting]] on the pointer values.
|
| 90 |
|
| 91 |
*Returns:* The first function template returns
|
| 92 |
+
|
| 93 |
+
``` cpp
|
| 94 |
+
less<unique_ptr<T, D>::pointer>()(x.get(), nullptr)
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
The second function template returns
|
| 98 |
+
|
| 99 |
+
``` cpp
|
| 100 |
+
less<unique_ptr<T, D>::pointer>()(nullptr, x.get())
|
| 101 |
+
```
|
| 102 |
|
| 103 |
``` cpp
|
| 104 |
template<class T, class D>
|
| 105 |
bool operator>(const unique_ptr<T, D>& x, nullptr_t);
|
| 106 |
template<class T, class D>
|
|
|
|
| 128 |
```
|
| 129 |
|
| 130 |
*Returns:* The first function template returns `!(x < nullptr)`. The
|
| 131 |
second function template returns `!(nullptr < x)`.
|
| 132 |
|
| 133 |
+
``` cpp
|
| 134 |
+
template<class T, class D>
|
| 135 |
+
requires three_way_comparable_with<typename unique_ptr<T, D>::pointer, nullptr_t>
|
| 136 |
+
compare_three_way_result_t<typename unique_ptr<T, D>::pointer, nullptr_t>
|
| 137 |
+
operator<=>(const unique_ptr<T, D>& x, nullptr_t);
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
*Returns:* `compare_three_way()(x.get(), nullptr)`.
|
| 141 |
+
|