From Jason Turner

[allocator.adaptor.members]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpmnq9yiwd/{from.md → to.md} +14 -143
tmp/tmpmnq9yiwd/{from.md → to.md} RENAMED
@@ -1,11 +1,11 @@
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*]
@@ -29,18 +29,18 @@ const outer_allocator_type& outer_allocator() const noexcept;
29
  ```
30
 
31
  *Returns:* `static_cast<const OuterAlloc&>(*this)`.
32
 
33
  ``` cpp
34
- pointer allocate(size_type n);
35
  ```
36
 
37
  *Returns:*
38
  `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`.
39
 
40
  ``` cpp
41
- pointer allocate(size_type n, const_void_pointer hint);
42
  ```
43
 
44
  *Returns:*
45
  `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`.
46
 
@@ -60,149 +60,20 @@ size_type max_size() const;
60
  ``` cpp
61
  template<class T, class... Args>
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);
 
1
+ ### Members <a id="allocator.adaptor.members">[[allocator.adaptor.members]]</a>
2
 
3
+ In the `construct` member functions, `OUTERMOST(x)` is
4
+ `OUTERMOST(x.outer_allocator())` if the expression `x.outer_allocator()`
5
+ is valid  [[temp.deduct]] and `x` otherwise; `OUTERMOST_ALLOC_TRAITS(x)`
6
+ is `allocator_traits<remove_reference_t<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*]
 
29
  ```
30
 
31
  *Returns:* `static_cast<const OuterAlloc&>(*this)`.
32
 
33
  ``` cpp
34
+ [[nodiscard]] pointer allocate(size_type n);
35
  ```
36
 
37
  *Returns:*
38
  `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`.
39
 
40
  ``` cpp
41
+ [[nodiscard]] pointer allocate(size_type n, const_void_pointer hint);
42
  ```
43
 
44
  *Returns:*
45
  `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`.
46
 
 
60
  ``` cpp
61
  template<class T, class... Args>
62
  void construct(T* p, Args&&... args);
63
  ```
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  *Effects:* Equivalent to:
66
 
67
  ``` cpp
68
+ apply([p, this](auto&&... newargs) {
69
+ OUTERMOST_ALLOC_TRAITS(*this)::construct(
70
+ OUTERMOST(*this), p,
71
+ std::forward<decltype(newargs)>(newargs)...);
72
+ },
73
+ uses_allocator_construction_args<T>(inner_allocator(),
74
+ std::forward<Args>(args)...));
 
 
 
 
 
 
 
 
 
75
  ```
76
 
77
  ``` cpp
78
  template<class T>
79
  void destroy(T* p);