tmp/tmpq12jhsle/{from.md → to.md}
RENAMED
|
@@ -36,17 +36,54 @@ class template instantiation of the form `SomeAllocator<T, Args>`, where
|
|
| 36 |
`rebind` member template, the standard `allocator_traits` template uses
|
| 37 |
`SomeAllocator<U, Args>` in place of `Allocator::{}rebind<U>::other` by
|
| 38 |
default. For allocator types that are not template instantiations of the
|
| 39 |
above form, no default is provided.
|
| 40 |
|
| 41 |
-
|
| 42 |
-
`X::
|
| 43 |
-
`
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
An allocator may constrain the types on which it can be instantiated and
|
| 50 |
the arguments for which its `construct` member may be called. If a type
|
| 51 |
cannot be used with a particular allocator, the allocator class or the
|
| 52 |
call to `construct` may fail to instantiate.
|
|
@@ -64,10 +101,15 @@ struct SimpleAllocator {
|
|
| 64 |
template <class T> SimpleAllocator(const SimpleAllocator<T>& other);
|
| 65 |
|
| 66 |
Tp* allocate(std::size_t n);
|
| 67 |
void deallocate(Tp* p, std::size_t n);
|
| 68 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
If the alignment associated with a specific over-aligned type is not
|
| 72 |
supported by an allocator, instantiation of the allocator for that type
|
| 73 |
may fail. The allocator also may silently ignore the requested
|
|
|
|
| 36 |
`rebind` member template, the standard `allocator_traits` template uses
|
| 37 |
`SomeAllocator<U, Args>` in place of `Allocator::{}rebind<U>::other` by
|
| 38 |
default. For allocator types that are not template instantiations of the
|
| 39 |
above form, no default is provided.
|
| 40 |
|
| 41 |
+
An allocator type `X` shall satisfy the requirements of
|
| 42 |
+
`CopyConstructible` ([[utility.arg.requirements]]). The `X::pointer`,
|
| 43 |
+
`X::const_pointer`, `X::void_pointer`, and `X::const_void_pointer` types
|
| 44 |
+
shall satisfy the requirements of `NullablePointer` (
|
| 45 |
+
[[nullablepointer.requirements]]). No constructor, comparison operator,
|
| 46 |
+
copy operation, move operation, or swap operation on these types shall
|
| 47 |
+
exit via an exception. `X::pointer` and `X::const_pointer` shall also
|
| 48 |
+
satisfy the requirements for a random access iterator (
|
| 49 |
+
[[iterator.requirements]]).
|
| 50 |
+
|
| 51 |
+
Let `x1` and `x2` denote objects of (possibly different) types
|
| 52 |
+
`X::void_pointer`, `X::const_void_pointer`, `X::pointer`, or
|
| 53 |
+
`X::const_pointer`. Then, `x1` and `x2` are *equivalently-valued*
|
| 54 |
+
pointer values, if and only if both `x1` and `x2` can be explicitly
|
| 55 |
+
converted to the two corresponding objects `px1` and `px2` of type
|
| 56 |
+
`X::const_pointer`, using a sequence of `static_cast`s using only these
|
| 57 |
+
four types, and the expression `px1 == px2` evaluates to `true`.
|
| 58 |
+
|
| 59 |
+
Let `w1` and `w2` denote objects of type `X::void_pointer`. Then for the
|
| 60 |
+
expressions
|
| 61 |
+
|
| 62 |
+
``` cpp
|
| 63 |
+
w1 == w2
|
| 64 |
+
w1 != w2
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
either or both objects may be replaced by an equivalently-valued object
|
| 68 |
+
of type `X::const_void_pointer` with no change in semantics.
|
| 69 |
+
|
| 70 |
+
Let `p1` and `p2` denote objects of type `X::pointer`. Then for the
|
| 71 |
+
expressions
|
| 72 |
+
|
| 73 |
+
``` cpp
|
| 74 |
+
p1 == p2
|
| 75 |
+
p1 != p2
|
| 76 |
+
p1 < p2
|
| 77 |
+
p1 <= p2
|
| 78 |
+
p1 >= p2
|
| 79 |
+
p1 > p2
|
| 80 |
+
p1 - p2
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
either or both objects may be replaced by an equivalently-valued object
|
| 84 |
+
of type `X::const_pointer` with no change in semantics.
|
| 85 |
|
| 86 |
An allocator may constrain the types on which it can be instantiated and
|
| 87 |
the arguments for which its `construct` member may be called. If a type
|
| 88 |
cannot be used with a particular allocator, the allocator class or the
|
| 89 |
call to `construct` may fail to instantiate.
|
|
|
|
| 101 |
template <class T> SimpleAllocator(const SimpleAllocator<T>& other);
|
| 102 |
|
| 103 |
Tp* allocate(std::size_t n);
|
| 104 |
void deallocate(Tp* p, std::size_t n);
|
| 105 |
};
|
| 106 |
+
|
| 107 |
+
template <class T, class U>
|
| 108 |
+
bool operator==(const SimpleAllocator<T>&, const SimpleAllocator<U>&);
|
| 109 |
+
template <class T, class U>
|
| 110 |
+
bool operator!=(const SimpleAllocator<T>&, const SimpleAllocator<U>&);
|
| 111 |
```
|
| 112 |
|
| 113 |
If the alignment associated with a specific over-aligned type is not
|
| 114 |
supported by an allocator, instantiation of the allocator for that type
|
| 115 |
may fail. The allocator also may silently ignore the requested
|