tmp/tmpyagv165d/{from.md → to.md}
RENAMED
|
@@ -59,28 +59,28 @@ return value or in-place, respectively.
|
|
| 59 |
be specified explicitly by the caller. — *end note*]
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
template<class T, class Alloc, class... Args>
|
| 63 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 64 |
-
Args&&... args) noexcept
|
| 65 |
```
|
| 66 |
|
| 67 |
-
*Constraints:* `T` is not a specialization of `pair`.
|
| 68 |
|
| 69 |
*Returns:* A `tuple` value determined as follows:
|
| 70 |
|
| 71 |
-
- If `uses_allocator_v<T, Alloc>` is `false` and
|
| 72 |
`is_constructible_v<T,Args...>` is `true`, return
|
| 73 |
`forward_as_tuple(std::forward<Args>(args)...)`.
|
| 74 |
-
- Otherwise, if `uses_allocator_v<T, Alloc>` is `true` and
|
| 75 |
`is_constructible_v<T, allocator_arg_t, const Alloc&, Args...>` is
|
| 76 |
`true`, return
|
| 77 |
``` cpp
|
| 78 |
tuple<allocator_arg_t, const Alloc&, Args&&...>(
|
| 79 |
allocator_arg, alloc, std::forward<Args>(args)...)
|
| 80 |
```
|
| 81 |
-
- Otherwise, if `uses_allocator_v<T, Alloc>` is `true` and
|
| 82 |
`is_constructible_v<T, Args..., const Alloc&>` is `true`, return
|
| 83 |
`forward_as_tuple(std::forward<Args>(args)..., alloc)`.
|
| 84 |
- Otherwise, the program is ill-formed.
|
| 85 |
|
| 86 |
[*Note 1*: This definition prevents a silent failure to pass the
|
|
@@ -88,17 +88,18 @@ allocator to a constructor of a type for which
|
|
| 88 |
`uses_allocator_v<T, Alloc>` is `true`. — *end note*]
|
| 89 |
|
| 90 |
``` cpp
|
| 91 |
template<class T, class Alloc, class Tuple1, class Tuple2>
|
| 92 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t,
|
| 93 |
-
Tuple1&& x, Tuple2&& y)
|
| 94 |
-
noexcept -> see below;
|
| 95 |
```
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
-
*
|
|
|
|
|
|
|
| 100 |
|
| 101 |
``` cpp
|
| 102 |
return make_tuple(
|
| 103 |
piecewise_construct,
|
| 104 |
apply([&alloc](auto&&... args1) {
|
|
@@ -111,14 +112,14 @@ return make_tuple(
|
|
| 111 |
}, std::forward<Tuple2>(y)));
|
| 112 |
```
|
| 113 |
|
| 114 |
``` cpp
|
| 115 |
template<class T, class Alloc>
|
| 116 |
-
constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept
|
| 117 |
```
|
| 118 |
|
| 119 |
-
*Constraints:* `T` is a specialization of `pair`.
|
| 120 |
|
| 121 |
*Effects:* Equivalent to:
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
@@ -126,14 +127,14 @@ return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
| 126 |
```
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
template<class T, class Alloc, class U, class V>
|
| 130 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 131 |
-
U&& u, V&& v) noexcept
|
| 132 |
```
|
| 133 |
|
| 134 |
-
*Constraints:* `T` is a specialization of `pair`.
|
| 135 |
|
| 136 |
*Effects:* Equivalent to:
|
| 137 |
|
| 138 |
``` cpp
|
| 139 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
@@ -142,14 +143,17 @@ return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
| 142 |
```
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
template<class T, class Alloc, class U, class V>
|
| 146 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
| 148 |
```
|
| 149 |
|
| 150 |
-
*Constraints:* `T` is a specialization of `pair`.
|
| 151 |
|
| 152 |
*Effects:* Equivalent to:
|
| 153 |
|
| 154 |
``` cpp
|
| 155 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
@@ -158,23 +162,88 @@ return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
| 158 |
```
|
| 159 |
|
| 160 |
``` cpp
|
| 161 |
template<class T, class Alloc, class U, class V>
|
| 162 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 163 |
-
pair<U,V>&& pr) noexcept
|
|
|
|
|
|
|
|
|
|
| 164 |
```
|
| 165 |
|
| 166 |
-
*Constraints:* `T` is a specialization of `pair`.
|
| 167 |
|
| 168 |
*Effects:* Equivalent to:
|
| 169 |
|
| 170 |
``` cpp
|
| 171 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
| 172 |
-
forward_as_tuple(std::move(pr)
|
| 173 |
-
forward_as_tuple(std::move(pr)
|
| 174 |
```
|
| 175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
``` cpp
|
| 177 |
template<class T, class Alloc, class... Args>
|
| 178 |
constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
|
| 179 |
```
|
| 180 |
|
|
|
|
| 59 |
be specified explicitly by the caller. — *end note*]
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
template<class T, class Alloc, class... Args>
|
| 63 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 64 |
+
Args&&... args) noexcept;
|
| 65 |
```
|
| 66 |
|
| 67 |
+
*Constraints:* `remove_cv_t<T>` is not a specialization of `pair`.
|
| 68 |
|
| 69 |
*Returns:* A `tuple` value determined as follows:
|
| 70 |
|
| 71 |
+
- If `uses_allocator_v<remove_cv_t<T>, Alloc>` is `false` and
|
| 72 |
`is_constructible_v<T,Args...>` is `true`, return
|
| 73 |
`forward_as_tuple(std::forward<Args>(args)...)`.
|
| 74 |
+
- Otherwise, if `uses_allocator_v<remove_cv_t<T>, Alloc>` is `true` and
|
| 75 |
`is_constructible_v<T, allocator_arg_t, const Alloc&, Args...>` is
|
| 76 |
`true`, return
|
| 77 |
``` cpp
|
| 78 |
tuple<allocator_arg_t, const Alloc&, Args&&...>(
|
| 79 |
allocator_arg, alloc, std::forward<Args>(args)...)
|
| 80 |
```
|
| 81 |
+
- Otherwise, if `uses_allocator_v<remove_cv_t<T>, Alloc>` is `true` and
|
| 82 |
`is_constructible_v<T, Args..., const Alloc&>` is `true`, return
|
| 83 |
`forward_as_tuple(std::forward<Args>(args)..., alloc)`.
|
| 84 |
- Otherwise, the program is ill-formed.
|
| 85 |
|
| 86 |
[*Note 1*: This definition prevents a silent failure to pass the
|
|
|
|
| 88 |
`uses_allocator_v<T, Alloc>` is `true`. — *end note*]
|
| 89 |
|
| 90 |
``` cpp
|
| 91 |
template<class T, class Alloc, class Tuple1, class Tuple2>
|
| 92 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t,
|
| 93 |
+
Tuple1&& x, Tuple2&& y) noexcept;
|
|
|
|
| 94 |
```
|
| 95 |
|
| 96 |
+
Let `T1` be `T::first_type`. Let `T2` be `T::second_type`.
|
| 97 |
|
| 98 |
+
*Constraints:* `remove_cv_t<T>` is a specialization of `pair`.
|
| 99 |
+
|
| 100 |
+
*Effects:* Equivalent to:
|
| 101 |
|
| 102 |
``` cpp
|
| 103 |
return make_tuple(
|
| 104 |
piecewise_construct,
|
| 105 |
apply([&alloc](auto&&... args1) {
|
|
|
|
| 112 |
}, std::forward<Tuple2>(y)));
|
| 113 |
```
|
| 114 |
|
| 115 |
``` cpp
|
| 116 |
template<class T, class Alloc>
|
| 117 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept;
|
| 118 |
```
|
| 119 |
|
| 120 |
+
*Constraints:* `remove_cv_t<T>` is a specialization of `pair`.
|
| 121 |
|
| 122 |
*Effects:* Equivalent to:
|
| 123 |
|
| 124 |
``` cpp
|
| 125 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
|
|
| 127 |
```
|
| 128 |
|
| 129 |
``` cpp
|
| 130 |
template<class T, class Alloc, class U, class V>
|
| 131 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 132 |
+
U&& u, V&& v) noexcept;
|
| 133 |
```
|
| 134 |
|
| 135 |
+
*Constraints:* `remove_cv_t<T>` is a specialization of `pair`.
|
| 136 |
|
| 137 |
*Effects:* Equivalent to:
|
| 138 |
|
| 139 |
``` cpp
|
| 140 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
|
|
| 143 |
```
|
| 144 |
|
| 145 |
``` cpp
|
| 146 |
template<class T, class Alloc, class U, class V>
|
| 147 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 148 |
+
pair<U, V>& pr) noexcept;
|
| 149 |
+
template<class T, class Alloc, class U, class V>
|
| 150 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 151 |
+
const pair<U, V>& pr) noexcept;
|
| 152 |
```
|
| 153 |
|
| 154 |
+
*Constraints:* `remove_cv_t<T>` is a specialization of `pair`.
|
| 155 |
|
| 156 |
*Effects:* Equivalent to:
|
| 157 |
|
| 158 |
``` cpp
|
| 159 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
|
|
|
| 162 |
```
|
| 163 |
|
| 164 |
``` cpp
|
| 165 |
template<class T, class Alloc, class U, class V>
|
| 166 |
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 167 |
+
pair<U, V>&& pr) noexcept;
|
| 168 |
+
template<class T, class Alloc, class U, class V>
|
| 169 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 170 |
+
const pair<U, V>&& pr) noexcept;
|
| 171 |
```
|
| 172 |
|
| 173 |
+
*Constraints:* `remove_cv_t<T>` is a specialization of `pair`.
|
| 174 |
|
| 175 |
*Effects:* Equivalent to:
|
| 176 |
|
| 177 |
``` cpp
|
| 178 |
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
| 179 |
+
forward_as_tuple(get<0>(std::move(pr))),
|
| 180 |
+
forward_as_tuple(get<1>(std::move(pr))));
|
| 181 |
```
|
| 182 |
|
| 183 |
+
``` cpp
|
| 184 |
+
template<class T, class Alloc, pair-like P>
|
| 185 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, P&& p) noexcept;
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
*Constraints:* `remove_cv_t<T>` is a specialization of `pair` and
|
| 189 |
+
`remove_cvref_t<P>` is not a specialization of `ranges::subrange`.
|
| 190 |
+
|
| 191 |
+
*Effects:* Equivalent to:
|
| 192 |
+
|
| 193 |
+
``` cpp
|
| 194 |
+
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
|
| 195 |
+
forward_as_tuple(get<0>(std::forward<P>(p))),
|
| 196 |
+
forward_as_tuple(get<1>(std::forward<P>(p))));
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
``` cpp
|
| 200 |
+
template<class T, class Alloc, class U>
|
| 201 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u) noexcept;
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
Let *FUN* be the function template:
|
| 205 |
+
|
| 206 |
+
``` cpp
|
| 207 |
+
template<class A, class B>
|
| 208 |
+
void FUN(const pair<A, B>&);
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
*Constraints:* `remove_cv_t<T>` is a specialization of `pair`, and
|
| 212 |
+
either:
|
| 213 |
+
|
| 214 |
+
- `remove_cvref_t<U>` is a specialization of `ranges::subrange`, or
|
| 215 |
+
- `U` does not satisfy `pair-like` and the expression *`FUN`*`(u)` is
|
| 216 |
+
not well-formed when considered as an unevaluated operand.
|
| 217 |
+
|
| 218 |
+
Let *pair-constructor* be an exposition-only class defined as follows:
|
| 219 |
+
|
| 220 |
+
``` cpp
|
| 221 |
+
class pair-constructor {
|
| 222 |
+
using pair-type = remove_cv_t<T>; // exposition only
|
| 223 |
+
|
| 224 |
+
constexpr auto do-construct(const pair-type& p) const { // exposition only
|
| 225 |
+
return make_obj_using_allocator<pair-type>(alloc_, p);
|
| 226 |
+
}
|
| 227 |
+
constexpr auto do-construct(pair-type&& p) const { // exposition only
|
| 228 |
+
return make_obj_using_allocator<pair-type>(alloc_, std::move(p));
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
const Alloc& alloc_; // exposition only
|
| 232 |
+
U& u_; // exposition only
|
| 233 |
+
|
| 234 |
+
public:
|
| 235 |
+
constexpr operator pair-type() const {
|
| 236 |
+
return do-construct(std::forward<U>(u_));
|
| 237 |
+
}
|
| 238 |
+
};
|
| 239 |
+
```
|
| 240 |
+
|
| 241 |
+
*Returns:* `make_tuple(pc)`, where `pc` is a *pair-constructor* object
|
| 242 |
+
whose *alloc\_* member is initialized with `alloc` and whose *u\_*
|
| 243 |
+
member is initialized with `u`.
|
| 244 |
+
|
| 245 |
``` cpp
|
| 246 |
template<class T, class Alloc, class... Args>
|
| 247 |
constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
|
| 248 |
```
|
| 249 |
|