tmp/tmpgubpz42z/{from.md → to.md}
RENAMED
|
@@ -1,22 +1,23 @@
|
|
| 1 |
### Header `<scoped_allocator>` synopsis <a id="allocator.adaptor.syn">[[allocator.adaptor.syn]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
|
|
|
|
| 5 |
template<class OuterAlloc, class... InnerAlloc>
|
| 6 |
class scoped_allocator_adaptor;
|
|
|
|
|
|
|
| 7 |
template<class OuterA1, class OuterA2, class... InnerAllocs>
|
| 8 |
bool operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
| 9 |
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
| 10 |
-
|
| 11 |
-
bool operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
| 12 |
-
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
| 13 |
```
|
| 14 |
|
| 15 |
The class template `scoped_allocator_adaptor` is an allocator template
|
| 16 |
-
that specifies
|
| 17 |
-
container (as any other allocator does) and also specifies an inner
|
| 18 |
allocator resource to be passed to the constructor of every element
|
| 19 |
within the container. This adaptor is instantiated with one outer and
|
| 20 |
zero or more inner allocator types. If instantiated with only one
|
| 21 |
allocator type, the inner allocator becomes the
|
| 22 |
`scoped_allocator_adaptor` itself, thus using the same allocator
|
|
@@ -40,10 +41,11 @@ namespace std {
|
|
| 40 |
template<class OuterAlloc, class... InnerAllocs>
|
| 41 |
class scoped_allocator_adaptor : public OuterAlloc {
|
| 42 |
private:
|
| 43 |
using OuterTraits = allocator_traits<OuterAlloc>; // exposition only
|
| 44 |
scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
|
|
|
|
| 45 |
public:
|
| 46 |
using outer_allocator_type = OuterAlloc;
|
| 47 |
using inner_allocator_type = see below;
|
| 48 |
|
| 49 |
using value_type = typename OuterTraits::value_type;
|
|
@@ -57,12 +59,11 @@ namespace std {
|
|
| 57 |
using propagate_on_container_copy_assignment = see below;
|
| 58 |
using propagate_on_container_move_assignment = see below;
|
| 59 |
using propagate_on_container_swap = see below;
|
| 60 |
using is_always_equal = see below;
|
| 61 |
|
| 62 |
-
template
|
| 63 |
-
struct rebind {
|
| 64 |
using other = scoped_allocator_adaptor<
|
| 65 |
OuterTraits::template rebind_alloc<Tp>, InnerAllocs...>;
|
| 66 |
};
|
| 67 |
|
| 68 |
scoped_allocator_adaptor();
|
|
@@ -88,43 +89,25 @@ namespace std {
|
|
| 88 |
inner_allocator_type& inner_allocator() noexcept;
|
| 89 |
const inner_allocator_type& inner_allocator() const noexcept;
|
| 90 |
outer_allocator_type& outer_allocator() noexcept;
|
| 91 |
const outer_allocator_type& outer_allocator() const noexcept;
|
| 92 |
|
| 93 |
-
pointer allocate(size_type n);
|
| 94 |
-
pointer allocate(size_type n, const_void_pointer hint);
|
| 95 |
void deallocate(pointer p, size_type n);
|
| 96 |
size_type max_size() const;
|
| 97 |
|
| 98 |
template<class T, class... Args>
|
| 99 |
void construct(T* p, Args&&... args);
|
| 100 |
-
template <class T1, class T2, class... Args1, class... Args2>
|
| 101 |
-
void construct(pair<T1, T2>* p, piecewise_construct_t,
|
| 102 |
-
tuple<Args1...> x, tuple<Args2...> y);
|
| 103 |
-
template <class T1, class T2>
|
| 104 |
-
void construct(pair<T1, T2>* p);
|
| 105 |
-
template <class T1, class T2, class U, class V>
|
| 106 |
-
void construct(pair<T1, T2>* p, U&& x, V&& y);
|
| 107 |
-
template <class T1, class T2, class U, class V>
|
| 108 |
-
void construct(pair<T1, T2>* p, const pair<U, V>& x);
|
| 109 |
-
template <class T1, class T2, class U, class V>
|
| 110 |
-
void construct(pair<T1, T2>* p, pair<U, V>&& x);
|
| 111 |
|
| 112 |
template<class T>
|
| 113 |
void destroy(T* p);
|
| 114 |
|
| 115 |
scoped_allocator_adaptor select_on_container_copy_construction() const;
|
| 116 |
};
|
| 117 |
|
| 118 |
template<class OuterAlloc, class... InnerAllocs>
|
| 119 |
scoped_allocator_adaptor(OuterAlloc, InnerAllocs...)
|
| 120 |
-> scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>;
|
| 121 |
-
|
| 122 |
-
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
| 123 |
-
bool operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
| 124 |
-
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
| 125 |
-
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
| 126 |
-
bool operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
| 127 |
-
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
| 128 |
}
|
| 129 |
```
|
| 130 |
|
|
|
|
| 1 |
### Header `<scoped_allocator>` synopsis <a id="allocator.adaptor.syn">[[allocator.adaptor.syn]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
// class template scoped allocator adaptor
|
| 6 |
template<class OuterAlloc, class... InnerAlloc>
|
| 7 |
class scoped_allocator_adaptor;
|
| 8 |
+
|
| 9 |
+
// [scoped.adaptor.operators], scoped allocator operators
|
| 10 |
template<class OuterA1, class OuterA2, class... InnerAllocs>
|
| 11 |
bool operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
| 12 |
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
| 13 |
+
}
|
|
|
|
|
|
|
| 14 |
```
|
| 15 |
|
| 16 |
The class template `scoped_allocator_adaptor` is an allocator template
|
| 17 |
+
that specifies an allocator resource (the outer allocator) to be used by
|
| 18 |
+
a container (as any other allocator does) and also specifies an inner
|
| 19 |
allocator resource to be passed to the constructor of every element
|
| 20 |
within the container. This adaptor is instantiated with one outer and
|
| 21 |
zero or more inner allocator types. If instantiated with only one
|
| 22 |
allocator type, the inner allocator becomes the
|
| 23 |
`scoped_allocator_adaptor` itself, thus using the same allocator
|
|
|
|
| 41 |
template<class OuterAlloc, class... InnerAllocs>
|
| 42 |
class scoped_allocator_adaptor : public OuterAlloc {
|
| 43 |
private:
|
| 44 |
using OuterTraits = allocator_traits<OuterAlloc>; // exposition only
|
| 45 |
scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
|
| 46 |
+
|
| 47 |
public:
|
| 48 |
using outer_allocator_type = OuterAlloc;
|
| 49 |
using inner_allocator_type = see below;
|
| 50 |
|
| 51 |
using value_type = typename OuterTraits::value_type;
|
|
|
|
| 59 |
using propagate_on_container_copy_assignment = see below;
|
| 60 |
using propagate_on_container_move_assignment = see below;
|
| 61 |
using propagate_on_container_swap = see below;
|
| 62 |
using is_always_equal = see below;
|
| 63 |
|
| 64 |
+
template<class Tp> struct rebind {
|
|
|
|
| 65 |
using other = scoped_allocator_adaptor<
|
| 66 |
OuterTraits::template rebind_alloc<Tp>, InnerAllocs...>;
|
| 67 |
};
|
| 68 |
|
| 69 |
scoped_allocator_adaptor();
|
|
|
|
| 89 |
inner_allocator_type& inner_allocator() noexcept;
|
| 90 |
const inner_allocator_type& inner_allocator() const noexcept;
|
| 91 |
outer_allocator_type& outer_allocator() noexcept;
|
| 92 |
const outer_allocator_type& outer_allocator() const noexcept;
|
| 93 |
|
| 94 |
+
[[nodiscard]] pointer allocate(size_type n);
|
| 95 |
+
[[nodiscard]] pointer allocate(size_type n, const_void_pointer hint);
|
| 96 |
void deallocate(pointer p, size_type n);
|
| 97 |
size_type max_size() const;
|
| 98 |
|
| 99 |
template<class T, class... Args>
|
| 100 |
void construct(T* p, Args&&... args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
template<class T>
|
| 103 |
void destroy(T* p);
|
| 104 |
|
| 105 |
scoped_allocator_adaptor select_on_container_copy_construction() const;
|
| 106 |
};
|
| 107 |
|
| 108 |
template<class OuterAlloc, class... InnerAllocs>
|
| 109 |
scoped_allocator_adaptor(OuterAlloc, InnerAllocs...)
|
| 110 |
-> scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
```
|
| 113 |
|