- tmp/tmpodnw4e9p/{from.md → to.md} +108 -70
tmp/tmpodnw4e9p/{from.md → to.md}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
### Scoped allocator adaptor members <a id="allocator.adaptor.members">[[allocator.adaptor.members]]</a>
|
| 2 |
|
| 3 |
-
In the `construct` member functions,
|
| 4 |
not have an `outer_allocator()` member function and
|
| 5 |
-
|
| 6 |
-
is
|
| 7 |
-
|
| 8 |
-
*
|
| 9 |
-
upon the definition of `outer_allocator()`
|
| 10 |
-
terminates. It will terminate for all
|
| 11 |
-
`scoped_allocator_adaptor`.
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
inner_allocator_type& inner_allocator() noexcept;
|
| 15 |
const inner_allocator_type& inner_allocator() const noexcept;
|
| 16 |
```
|
|
@@ -46,12 +46,12 @@ pointer allocate(size_type n, const_void_pointer hint);
|
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
void deallocate(pointer p, size_type n) noexcept;
|
| 49 |
```
|
| 50 |
|
| 51 |
-
*Effects:*
|
| 52 |
-
`allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n)
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
size_type max_size() const;
|
| 56 |
```
|
| 57 |
|
|
@@ -62,123 +62,161 @@ template <class T, class... Args>
|
|
| 62 |
void construct(T* p, Args&&... args);
|
| 63 |
```
|
| 64 |
|
| 65 |
*Effects:*
|
| 66 |
|
| 67 |
-
- If `
|
| 68 |
-
`
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
`
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
`
|
| 77 |
-
|
| 78 |
-
`
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
`
|
| 82 |
-
- Otherwise,
|
| 83 |
-
`
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
``` cpp
|
| 88 |
template <class T1, class T2, class... Args1, class... Args2>
|
| 89 |
void construct(pair<T1, T2>* p, piecewise_construct_t,
|
| 90 |
tuple<Args1...> x, tuple<Args2...> y);
|
| 91 |
```
|
| 92 |
|
| 93 |
*Requires:* all of the types in `Args1` and `Args2` shall be
|
| 94 |
-
`CopyConstructible` (Table [[copyconstructible]]).
|
| 95 |
|
| 96 |
*Effects:* Constructs a `tuple` object `xprime` from `x` by the
|
| 97 |
following rules:
|
| 98 |
|
| 99 |
-
- If `
|
| 100 |
-
`
|
| 101 |
-
`x`.
|
| 102 |
-
- Otherwise, if `
|
| 103 |
-
|
| 104 |
-
`
|
| 105 |
-
is `true`, then `xprime` is
|
| 106 |
-
`
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
`
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
- Otherwise, the program is ill-formed.
|
| 113 |
|
| 114 |
and constructs a `tuple` object `yprime` from `y` by the following
|
| 115 |
rules:
|
| 116 |
|
| 117 |
-
- If `
|
| 118 |
-
`
|
| 119 |
-
`y`.
|
| 120 |
-
- Otherwise, if `
|
| 121 |
-
|
| 122 |
-
`
|
| 123 |
-
is `true`, then `yprime` is
|
| 124 |
-
`
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
`
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
- Otherwise, the program is ill-formed.
|
| 131 |
|
| 132 |
-
then calls
|
| 133 |
-
|
| 134 |
-
`
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
``` cpp
|
| 137 |
template <class T1, class T2>
|
| 138 |
void construct(pair<T1, T2>* p);
|
| 139 |
```
|
| 140 |
|
| 141 |
-
*Effects:* Equivalent to
|
| 142 |
-
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
template <class T1, class T2, class U, class V>
|
| 146 |
void construct(pair<T1, T2>* p, U&& x, V&& y);
|
| 147 |
```
|
| 148 |
|
| 149 |
-
*Effects:* Equivalent to
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
template <class T1, class T2, class U, class V>
|
| 154 |
void construct(pair<T1, T2>* p, const pair<U, V>& x);
|
| 155 |
```
|
| 156 |
|
| 157 |
-
*Effects:* Equivalent to
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
``` cpp
|
| 161 |
template <class T1, class T2, class U, class V>
|
| 162 |
void construct(pair<T1, T2>* p, pair<U, V>&& x);
|
| 163 |
```
|
| 164 |
|
| 165 |
-
*Effects:* Equivalent to
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
``` cpp
|
| 169 |
template <class T>
|
| 170 |
void destroy(T* p);
|
| 171 |
```
|
| 172 |
|
| 173 |
-
*Effects:*
|
| 174 |
-
*
|
| 175 |
|
| 176 |
``` cpp
|
| 177 |
scoped_allocator_adaptor select_on_container_copy_construction() const;
|
| 178 |
```
|
| 179 |
|
| 180 |
-
*Returns:* A new scoped_allocator_adaptor object where each allocator
|
| 181 |
`A` in the adaptor is initialized from the result of calling
|
| 182 |
`allocator_traits<A>::select_on_container_copy_construction()` on the
|
| 183 |
corresponding allocator in `*this`.
|
| 184 |
|
|
|
|
| 1 |
### Scoped allocator adaptor members <a id="allocator.adaptor.members">[[allocator.adaptor.members]]</a>
|
| 2 |
|
| 3 |
+
In the `construct` member functions, `OUTERMOST(x)` is `x` if `x` does
|
| 4 |
not have an `outer_allocator()` member function and
|
| 5 |
+
`OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)`
|
| 6 |
+
is `allocator_traits<decltype(OUTERMOST(x))>`.
|
| 7 |
+
|
| 8 |
+
[*Note 1*: `OUTERMOST(x)` and `OUTERMOST_ALLOC_TRAITS(x)` are recursive
|
| 9 |
+
operations. It is incumbent upon the definition of `outer_allocator()`
|
| 10 |
+
to ensure that the recursion terminates. It will terminate for all
|
| 11 |
+
instantiations of `scoped_allocator_adaptor`. — *end note*]
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
inner_allocator_type& inner_allocator() noexcept;
|
| 15 |
const inner_allocator_type& inner_allocator() const noexcept;
|
| 16 |
```
|
|
|
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
void deallocate(pointer p, size_type n) noexcept;
|
| 49 |
```
|
| 50 |
|
| 51 |
+
*Effects:* As if by:
|
| 52 |
+
`allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n);`
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
size_type max_size() const;
|
| 56 |
```
|
| 57 |
|
|
|
|
| 62 |
void construct(T* p, Args&&... args);
|
| 63 |
```
|
| 64 |
|
| 65 |
*Effects:*
|
| 66 |
|
| 67 |
+
- If `uses_allocator_v<T, inner_allocator_type>` is `false` and
|
| 68 |
+
`is_constructible_v<T,`
|
| 69 |
+
`Args...>` is `true`, calls:
|
| 70 |
+
``` cpp
|
| 71 |
+
OUTERMOST_ALLOC_TRAITS(*this)::construct(
|
| 72 |
+
OUTERMOST(*this), p, std::forward<Args>(args)...)
|
| 73 |
+
```
|
| 74 |
+
- Otherwise, if `uses_allocator_v<T, inner_allocator_type>` is `true`
|
| 75 |
+
and
|
| 76 |
+
`is_constructible_v<T, allocator_arg_t, inner_allocator_type&, Args...>`
|
| 77 |
+
is `true`, calls:
|
| 78 |
+
``` cpp
|
| 79 |
+
OUTERMOST_ALLOC_TRAITS(*this)::construct(
|
| 80 |
+
OUTERMOST(*this), p, allocator_arg, inner_allocator(), std::forward<Args>(args)...)
|
| 81 |
+
```
|
| 82 |
+
- Otherwise, if `uses_allocator_v<T, inner_allocator_type>` is `true`
|
| 83 |
+
and `is_constructible_v<T, Args..., inner_allocator_type&>` is `true`,
|
| 84 |
+
calls:
|
| 85 |
+
``` cpp
|
| 86 |
+
OUTERMOST_ALLOC_TRAITS(*this)::construct(
|
| 87 |
+
OUTERMOST(*this), p, std::forward<Args>(args)..., inner_allocator())
|
| 88 |
+
```
|
| 89 |
+
- Otherwise, the program is ill-formed. \[*Note 2*: An error will result
|
| 90 |
+
if `uses_allocator` evaluates to `true` but the specific constructor
|
| 91 |
+
does not take an allocator. This definition prevents a silent failure
|
| 92 |
+
to pass an inner allocator to a contained element. — *end note*]
|
| 93 |
|
| 94 |
``` cpp
|
| 95 |
template <class T1, class T2, class... Args1, class... Args2>
|
| 96 |
void construct(pair<T1, T2>* p, piecewise_construct_t,
|
| 97 |
tuple<Args1...> x, tuple<Args2...> y);
|
| 98 |
```
|
| 99 |
|
| 100 |
*Requires:* all of the types in `Args1` and `Args2` shall be
|
| 101 |
+
`CopyConstructible` (Table [[tab:copyconstructible]]).
|
| 102 |
|
| 103 |
*Effects:* Constructs a `tuple` object `xprime` from `x` by the
|
| 104 |
following rules:
|
| 105 |
|
| 106 |
+
- If `uses_allocator_v<T1, inner_allocator_type>` is `false` and
|
| 107 |
+
`is_constructible_v<T1,`
|
| 108 |
+
`Args1...>` is `true`, then `xprime` is `x`.
|
| 109 |
+
- Otherwise, if `uses_allocator_v<T1, inner_allocator_type>` is `true`
|
| 110 |
+
and
|
| 111 |
+
`is_constructible_v<T1, allocator_arg_t, inner_allocator_type&, Args1...>`
|
| 112 |
+
is `true`, then `xprime` is:
|
| 113 |
+
``` cpp
|
| 114 |
+
tuple_cat(
|
| 115 |
+
tuple<allocator_arg_t, inner_allocator_type&>(allocator_arg, inner_allocator()),
|
| 116 |
+
std::move(x))
|
| 117 |
+
```
|
| 118 |
+
- Otherwise, if `uses_allocator_v<T1, inner_allocator_type>` is `true`
|
| 119 |
+
and `is_constructible_v<T1, Args1..., inner_allocator_type&>` is
|
| 120 |
+
`true`, then `xprime` is:
|
| 121 |
+
``` cpp
|
| 122 |
+
tuple_cat(std::move(x), tuple<inner_allocator_type&>(inner_allocator()))
|
| 123 |
+
```
|
| 124 |
- Otherwise, the program is ill-formed.
|
| 125 |
|
| 126 |
and constructs a `tuple` object `yprime` from `y` by the following
|
| 127 |
rules:
|
| 128 |
|
| 129 |
+
- If `uses_allocator_v<T2, inner_allocator_type>` is `false` and
|
| 130 |
+
`is_constructible_v<T2,`
|
| 131 |
+
`Args2...>` is `true`, then `yprime` is `y`.
|
| 132 |
+
- Otherwise, if `uses_allocator_v<T2, inner_allocator_type>` is `true`
|
| 133 |
+
and
|
| 134 |
+
`is_constructible_v<T2, allocator_arg_t, inner_allocator_type&, Args2...>`
|
| 135 |
+
is `true`, then `yprime` is:
|
| 136 |
+
``` cpp
|
| 137 |
+
tuple_cat(
|
| 138 |
+
tuple<allocator_arg_t, inner_allocator_type&>(allocator_arg, inner_allocator()),
|
| 139 |
+
std::move(y))
|
| 140 |
+
```
|
| 141 |
+
- Otherwise, if `uses_allocator_v<T2, inner_allocator_type>` is `true`
|
| 142 |
+
and `is_constructible_v<T2, Args2..., inner_allocator_type&>` is
|
| 143 |
+
`true`, then `yprime` is:
|
| 144 |
+
``` cpp
|
| 145 |
+
tuple_cat(std::move(y), tuple<inner_allocator_type&>(inner_allocator()))
|
| 146 |
+
```
|
| 147 |
- Otherwise, the program is ill-formed.
|
| 148 |
|
| 149 |
+
then calls:
|
| 150 |
+
|
| 151 |
+
``` cpp
|
| 152 |
+
OUTERMOST_ALLOC_TRAITS(*this)::construct(
|
| 153 |
+
OUTERMOST(*this), p, piecewise_construct, std::move(xprime), std::move(yprime))
|
| 154 |
+
```
|
| 155 |
|
| 156 |
``` cpp
|
| 157 |
template <class T1, class T2>
|
| 158 |
void construct(pair<T1, T2>* p);
|
| 159 |
```
|
| 160 |
|
| 161 |
+
*Effects:* Equivalent to:
|
| 162 |
+
|
| 163 |
+
``` cpp
|
| 164 |
+
construct(p, piecewise_construct, tuple<>(), tuple<>());
|
| 165 |
+
```
|
| 166 |
|
| 167 |
``` cpp
|
| 168 |
template <class T1, class T2, class U, class V>
|
| 169 |
void construct(pair<T1, T2>* p, U&& x, V&& y);
|
| 170 |
```
|
| 171 |
|
| 172 |
+
*Effects:* Equivalent to:
|
| 173 |
+
|
| 174 |
+
``` cpp
|
| 175 |
+
construct(p, piecewise_construct,
|
| 176 |
+
forward_as_tuple(std::forward<U>(x)),
|
| 177 |
+
forward_as_tuple(std::forward<V>(y)));
|
| 178 |
+
```
|
| 179 |
|
| 180 |
``` cpp
|
| 181 |
template <class T1, class T2, class U, class V>
|
| 182 |
void construct(pair<T1, T2>* p, const pair<U, V>& x);
|
| 183 |
```
|
| 184 |
|
| 185 |
+
*Effects:* Equivalent to:
|
| 186 |
+
|
| 187 |
+
``` cpp
|
| 188 |
+
construct(p, piecewise_construct,
|
| 189 |
+
forward_as_tuple(x.first),
|
| 190 |
+
forward_as_tuple(x.second));
|
| 191 |
+
```
|
| 192 |
|
| 193 |
``` cpp
|
| 194 |
template <class T1, class T2, class U, class V>
|
| 195 |
void construct(pair<T1, T2>* p, pair<U, V>&& x);
|
| 196 |
```
|
| 197 |
|
| 198 |
+
*Effects:* Equivalent to:
|
| 199 |
+
|
| 200 |
+
``` cpp
|
| 201 |
+
construct(p, piecewise_construct,
|
| 202 |
+
forward_as_tuple(std::forward<U>(x.first)),
|
| 203 |
+
forward_as_tuple(std::forward<V>(x.second)));
|
| 204 |
+
```
|
| 205 |
|
| 206 |
``` cpp
|
| 207 |
template <class T>
|
| 208 |
void destroy(T* p);
|
| 209 |
```
|
| 210 |
|
| 211 |
+
*Effects:* Calls
|
| 212 |
+
*OUTERMOST_ALLOC_TRAITS*(\*this)::destroy(*OUTERMOST*(\*this), p).
|
| 213 |
|
| 214 |
``` cpp
|
| 215 |
scoped_allocator_adaptor select_on_container_copy_construction() const;
|
| 216 |
```
|
| 217 |
|
| 218 |
+
*Returns:* A new `scoped_allocator_adaptor` object where each allocator
|
| 219 |
`A` in the adaptor is initialized from the result of calling
|
| 220 |
`allocator_traits<A>::select_on_container_copy_construction()` on the
|
| 221 |
corresponding allocator in `*this`.
|
| 222 |
|