tmp/tmprrb787mn/{from.md → to.md}
RENAMED
|
@@ -1,20 +1,22 @@
|
|
| 1 |
#### Allocator-aware containers <a id="container.alloc.reqmts">[[container.alloc.reqmts]]</a>
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
| 5 |
*allocator-aware container*, as described below.
|
| 6 |
|
| 7 |
Given an allocator type `A` and given a container type `X` having a
|
| 8 |
`value_type` identical to `T` and an `allocator_type` identical to
|
| 9 |
`allocator_traits<A>::rebind_alloc<T>` and given an lvalue `m` of type
|
| 10 |
-
`A`, a pointer `p` of type `T*`, an expression `v`
|
| 11 |
-
`const T`
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
`allocator<T>` — no allocator object
|
| 15 |
-
specializations of `allocator<T>` are not
|
|
|
|
| 16 |
|
| 17 |
- `T` is **Cpp17DefaultInsertable* into `X`* means that the following
|
| 18 |
expression is well-formed:
|
| 19 |
``` cpp
|
| 20 |
allocator_traits<A>::construct(m, p)
|
|
@@ -35,11 +37,11 @@ specializations of `allocator<T>` are not instantiated:
|
|
| 35 |
|
| 36 |
and its evaluation causes the following postcondition to hold: The
|
| 37 |
value of `*p` is equivalent to the value of `rv` before the
|
| 38 |
evaluation.
|
| 39 |
\[*Note 1*: `rv` remains a valid object. Its state is
|
| 40 |
-
unspecified — *end note*]
|
| 41 |
- `T` is **Cpp17CopyInsertable* into `X`* means that, in addition to `T`
|
| 42 |
being *Cpp17MoveInsertable* into `X`, the following expression is
|
| 43 |
well-formed:
|
| 44 |
``` cpp
|
| 45 |
allocator_traits<A>::construct(m, p, v)
|
|
@@ -119,11 +121,11 @@ X u(m);
|
|
| 119 |
X u(t, m);
|
| 120 |
```
|
| 121 |
|
| 122 |
*Preconditions:* `T` is *Cpp17CopyInsertable* into `X`.
|
| 123 |
|
| 124 |
-
*Ensures:* `u == t`, `u.get_allocator() == m`
|
| 125 |
|
| 126 |
*Complexity:* Linear.
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
X u(rv);
|
|
|
|
| 1 |
#### Allocator-aware containers <a id="container.alloc.reqmts">[[container.alloc.reqmts]]</a>
|
| 2 |
|
| 3 |
+
Except for `array` and `inplace_vector`, all of the containers defined
|
| 4 |
+
in [[containers]], [[stacktrace.basic]], [[basic.string]], and
|
| 5 |
+
[[re.results]] meet the additional requirements of an
|
| 6 |
*allocator-aware container*, as described below.
|
| 7 |
|
| 8 |
Given an allocator type `A` and given a container type `X` having a
|
| 9 |
`value_type` identical to `T` and an `allocator_type` identical to
|
| 10 |
`allocator_traits<A>::rebind_alloc<T>` and given an lvalue `m` of type
|
| 11 |
+
`A`, a pointer `p` of type `T*`, an expression `v` that denotes an
|
| 12 |
+
lvalue of type `T` or `const T` or an rvalue of type `const T`, and an
|
| 13 |
+
rvalue `rv` of type `T`, the following terms are defined. If `X` is not
|
| 14 |
+
allocator-aware or is a specialization of `basic_string`, the terms
|
| 15 |
+
below are defined as if `A` were `allocator<T>` — no allocator object
|
| 16 |
+
needs to be created and user specializations of `allocator<T>` are not
|
| 17 |
+
instantiated:
|
| 18 |
|
| 19 |
- `T` is **Cpp17DefaultInsertable* into `X`* means that the following
|
| 20 |
expression is well-formed:
|
| 21 |
``` cpp
|
| 22 |
allocator_traits<A>::construct(m, p)
|
|
|
|
| 37 |
|
| 38 |
and its evaluation causes the following postcondition to hold: The
|
| 39 |
value of `*p` is equivalent to the value of `rv` before the
|
| 40 |
evaluation.
|
| 41 |
\[*Note 1*: `rv` remains a valid object. Its state is
|
| 42 |
+
unspecified. — *end note*]
|
| 43 |
- `T` is **Cpp17CopyInsertable* into `X`* means that, in addition to `T`
|
| 44 |
being *Cpp17MoveInsertable* into `X`, the following expression is
|
| 45 |
well-formed:
|
| 46 |
``` cpp
|
| 47 |
allocator_traits<A>::construct(m, p, v)
|
|
|
|
| 121 |
X u(t, m);
|
| 122 |
```
|
| 123 |
|
| 124 |
*Preconditions:* `T` is *Cpp17CopyInsertable* into `X`.
|
| 125 |
|
| 126 |
+
*Ensures:* `u == t`, `u.get_allocator() == m`.
|
| 127 |
|
| 128 |
*Complexity:* Linear.
|
| 129 |
|
| 130 |
``` cpp
|
| 131 |
X u(rv);
|