From Jason Turner

[allocator.adaptor.members]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. 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, *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
7
- `allocator_traits<decltype(OUTERMOST(x))>`. *OUTERMOST*(x) and
8
- *OUTERMOST_ALLOC_TRAITS*(x) are recursive operations. It is incumbent
9
- upon the definition of `outer_allocator()` to ensure that the recursion
10
- terminates. It will terminate for all instantiations of
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 `uses_allocator<T, inner_allocator_type>::value` is `false` and
68
- `is_constructible<T, Args...>::value` is `true`, calls
69
- *OUTERMOST_ALLOC_TRAITS*(`*this`)`::construct(`
70
- *`OUTERMOST`*`(*this), p, std::forward<Args>(args)...)`.
71
- - Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is
72
- `true` and
73
- `is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value`
74
- is `true`, calls
75
- *OUTERMOST_ALLOC_TRAITS*(`*this`)`::construct(`*`OUTERMOST`*`(*this), p, allocator_arg,`
76
- `inner_allocator(), std::forward<Args>(args)...)`.
77
- - Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is
78
- `true` and `is_constructible<T, Args..., inner_allocator_type>::value`
79
- is `true`, calls *OUTERMOST_ALLOC_TRAITS*(\*this)::
80
- `construct(`*`OUTERMOST`*`(*this), p, std::forward<Args>(args)...,`
81
- `inner_allocator())`.
82
- - Otherwise, the program is ill-formed. An error will result if
83
- `uses_allocator` evaluates to true but the specific constructor does
84
- not take an allocator. This definition prevents a silent failure to
85
- pass an inner allocator to a contained element.
 
 
 
 
 
 
 
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 `uses_allocator<T1, inner_allocator_type>::value` is `false` and
100
- `is_constructible<T1, Args1...>::value` is `true`, then `xprime` is
101
- `x`.
102
- - Otherwise, if `uses_allocator<T1, inner_allocator_type>::value` is
103
- `true` and
104
- `is_constructible<T1, allocator_arg_t, inner_allocator_type, Args1...>::value`
105
- is `true`, then `xprime` is
106
- `tuple_cat(tuple<allocator_arg_t, inner_allocator_type&>( allocator_arg, inner_allocator()), std::move(x))`.
107
- - Otherwise, if `uses_allocator<T1, inner_allocator_type>::value` is
108
- `true` and
109
- `is_constructible<T1, Args1..., inner_allocator_type>::value` is
110
- `true`, then `xprime` is
111
- `tuple_cat(std::move(x), tuple<inner_allocator_type&>(inner_allocator()))`.
 
 
 
 
 
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 `uses_allocator<T2, inner_allocator_type>::value` is `false` and
118
- `is_constructible<T2, Args2...>::value` is `true`, then `yprime` is
119
- `y`.
120
- - Otherwise, if `uses_allocator<T2, inner_allocator_type>::value` is
121
- `true` and
122
- `is_constructible<T2, allocator_arg_t, inner_allocator_type, Args2...>::value`
123
- is `true`, then `yprime` is
124
- `tuple_cat(tuple<allocator_arg_t, inner_allocator_type&>( allocator_arg, inner_allocator()), std::move(y))`.
125
- - Otherwise, if `uses_allocator<T2, inner_allocator_type>::value` is
126
- `true` and
127
- `is_constructible<T2, Args2..., inner_allocator_type>::value` is
128
- `true`, then `yprime` is
129
- `tuple_cat(std::move(y), tuple<inner_allocator_type&>(inner_allocator()))`.
 
 
 
 
 
130
  - Otherwise, the program is ill-formed.
131
 
132
- then calls
133
- *`OUTERMOST_ALLOC_TRAITS`*`(*this)::construct(`*`OUTERMOST`*`(*this), p,`
134
- `piecewise_construct, std::move(xprime), std::move(yprime))`.
 
 
 
135
 
136
  ``` cpp
137
  template <class T1, class T2>
138
  void construct(pair<T1, T2>* p);
139
  ```
140
 
141
- *Effects:* Equivalent to
142
- `this->construct(p, piecewise_construct, tuple<>(), tuple<>())`.
 
 
 
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
- `this->construct(p, piecewise_construct, forward_as_tuple(std::forward<U>(x)), forward_as_tuple(std::forward<V>(y)))`.
 
 
 
 
 
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
- `this->construct(p, piecewise_construct, forward_as_tuple(x.first), forward_as_tuple(x.second))`.
 
 
 
 
 
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
- `this->construct(p, piecewise_construct, forward_as_tuple(std::forward<U>(x.first)), forward_as_tuple(std::forward<V>(x.second)))`.
 
 
 
 
 
167
 
168
  ``` cpp
169
  template <class T>
170
  void destroy(T* p);
171
  ```
172
 
173
- *Effects:* calls
174
- *`OUTERMOST_ALLOC_TRAITS`*`(*this)::destroy(`*`OUTERMOST`*`(*this), p)`.
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