From Jason Turner

[unique.ptr.special]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwz82ymq1/{from.md → to.md} +18 -14
tmp/tmpwz82ymq1/{from.md → to.md} RENAMED
@@ -1,18 +1,18 @@
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
@@ -70,20 +70,20 @@ template<class T1, class D1, class T2, class D2>
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.
@@ -100,42 +100,46 @@ The second function template returns
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>
107
- bool operator>(nullptr_t, const unique_ptr<T, D>& x);
108
  ```
109
 
110
  *Returns:* The first function template returns `nullptr < x`. The second
111
  function template returns `x < nullptr`.
112
 
113
  ``` cpp
114
  template<class T, class D>
115
- bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
116
  template<class T, class D>
117
- bool operator<=(nullptr_t, const unique_ptr<T, D>& x);
118
  ```
119
 
120
  *Returns:* The first function template returns `!(nullptr < x)`. The
121
  second function template returns `!(x < nullptr)`.
122
 
123
  ``` cpp
124
  template<class T, class D>
125
- bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
126
  template<class T, class D>
127
- bool operator>=(nullptr_t, const unique_ptr<T, D>& x);
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
 
 
1
  #### Specialized algorithms <a id="unique.ptr.special">[[unique.ptr.special]]</a>
2
 
3
  ``` cpp
4
+ template<class T, class D> constexpr 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
+ constexpr 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
 
70
 
71
  *Returns:* `compare_three_way()(x.get(), y.get())`.
72
 
73
  ``` cpp
74
  template<class T, class D>
75
+ constexpr 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
+ constexpr bool operator<(const unique_ptr<T, D>& x, nullptr_t);
83
  template<class T, class D>
84
+ constexpr 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.
 
100
  less<unique_ptr<T, D>::pointer>()(nullptr, x.get())
101
  ```
102
 
103
  ``` cpp
104
  template<class T, class D>
105
+ constexpr bool operator>(const unique_ptr<T, D>& x, nullptr_t);
106
  template<class T, class D>
107
+ constexpr bool operator>(nullptr_t, const unique_ptr<T, D>& x);
108
  ```
109
 
110
  *Returns:* The first function template returns `nullptr < x`. The second
111
  function template returns `x < nullptr`.
112
 
113
  ``` cpp
114
  template<class T, class D>
115
+ constexpr bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
116
  template<class T, class D>
117
+ constexpr bool operator<=(nullptr_t, const unique_ptr<T, D>& x);
118
  ```
119
 
120
  *Returns:* The first function template returns `!(nullptr < x)`. The
121
  second function template returns `!(x < nullptr)`.
122
 
123
  ``` cpp
124
  template<class T, class D>
125
+ constexpr bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
126
  template<class T, class D>
127
+ constexpr bool operator>=(nullptr_t, const unique_ptr<T, D>& x);
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<typename unique_ptr<T, D>::pointer>
136
+ constexpr compare_three_way_result_t<typename unique_ptr<T, D>::pointer>
137
  operator<=>(const unique_ptr<T, D>& x, nullptr_t);
138
  ```
139
 
140
+ *Returns:*
141
+
142
+ ``` cpp
143
+ compare_three_way()(x.get(), static_cast<typename unique_ptr<T, D>::pointer>(nullptr)).
144
+ ```
145