From Jason Turner

[allocator.traits]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwin216wa/{from.md → to.md} +34 -35
tmp/tmpwin216wa/{from.md → to.md} RENAMED
@@ -28,170 +28,169 @@ namespace std {
28
  using is_always_equal = see below;
29
 
30
  template<class T> using rebind_alloc = see below;
31
  template<class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
32
 
33
- static pointer allocate(Alloc& a, size_type n);
34
- static pointer allocate(Alloc& a, size_type n, const_void_pointer hint);
 
35
 
36
- static void deallocate(Alloc& a, pointer p, size_type n);
37
 
38
  template<class T, class... Args>
39
- static void construct(Alloc& a, T* p, Args&&... args);
40
 
41
  template<class T>
42
- static void destroy(Alloc& a, T* p);
43
 
44
- static size_type max_size(const Alloc& a) noexcept;
45
 
46
- static Alloc select_on_container_copy_construction(const Alloc& rhs);
47
  };
48
  }
49
  ```
50
 
51
- #### Allocator traits member types <a id="allocator.traits.types">[[allocator.traits.types]]</a>
52
 
53
  ``` cpp
54
  using pointer = see below;
55
  ```
56
 
57
  *Type:* `Alloc::pointer` if the *qualified-id* `Alloc::pointer` is valid
58
- and denotes a type ([[temp.deduct]]); otherwise, `value_type*`.
59
 
60
  ``` cpp
61
  using const_pointer = see below;
62
  ```
63
 
64
  *Type:* `Alloc::const_pointer` if the *qualified-id*
65
- `Alloc::const_pointer` is valid and denotes a type ([[temp.deduct]]);
66
  otherwise, `pointer_traits<pointer>::rebind<const value_type>`.
67
 
68
  ``` cpp
69
  using void_pointer = see below;
70
  ```
71
 
72
  *Type:* `Alloc::void_pointer` if the *qualified-id*
73
- `Alloc::void_pointer` is valid and denotes a type ([[temp.deduct]]);
74
  otherwise, `pointer_traits<pointer>::rebind<void>`.
75
 
76
  ``` cpp
77
  using const_void_pointer = see below;
78
  ```
79
 
80
  *Type:* `Alloc::const_void_pointer` if the *qualified-id*
81
- `Alloc::const_void_pointer` is valid and denotes a
82
- type ([[temp.deduct]]); otherwise,
83
- `pointer_traits<pointer>::rebind<const void>`.
84
 
85
  ``` cpp
86
  using difference_type = see below;
87
  ```
88
 
89
  *Type:* `Alloc::difference_type` if the *qualified-id*
90
- `Alloc::difference_type` is valid and denotes a type ([[temp.deduct]]);
91
  otherwise, `pointer_traits<pointer>::difference_type`.
92
 
93
  ``` cpp
94
  using size_type = see below;
95
  ```
96
 
97
  *Type:* `Alloc::size_type` if the *qualified-id* `Alloc::size_type` is
98
- valid and denotes a type ([[temp.deduct]]); otherwise,
99
  `make_unsigned_t<difference_type>`.
100
 
101
  ``` cpp
102
  using propagate_on_container_copy_assignment = see below;
103
  ```
104
 
105
  *Type:* `Alloc::propagate_on_container_copy_assignment` if the
106
  *qualified-id* `Alloc::propagate_on_container_copy_assignment` is valid
107
- and denotes a type ([[temp.deduct]]); otherwise `false_type`.
108
 
109
  ``` cpp
110
  using propagate_on_container_move_assignment = see below;
111
  ```
112
 
113
  *Type:* `Alloc::propagate_on_container_move_assignment` if the
114
  *qualified-id* `Alloc::propagate_on_container_move_assignment` is valid
115
- and denotes a type ([[temp.deduct]]); otherwise `false_type`.
116
 
117
  ``` cpp
118
  using propagate_on_container_swap = see below;
119
  ```
120
 
121
  *Type:* `Alloc::propagate_on_container_swap` if the *qualified-id*
122
  `Alloc::propagate_on_container_swap` is valid and denotes a
123
- type ([[temp.deduct]]); otherwise `false_type`.
124
 
125
  ``` cpp
126
  using is_always_equal = see below;
127
  ```
128
 
129
  *Type:* `Alloc::is_always_equal` if the *qualified-id*
130
- `Alloc::is_always_equal` is valid and denotes a type ([[temp.deduct]]);
131
  otherwise `is_empty<Alloc>::type`.
132
 
133
  ``` cpp
134
  template<class T> using rebind_alloc = see below;
135
  ```
136
 
137
  *Alias template:* `Alloc::rebind<T>::other` if the *qualified-id*
138
- `Alloc::rebind<T>::other` is valid and denotes a
139
- type ([[temp.deduct]]); otherwise, `Alloc<T, Args>` if `Alloc` is a
140
- class template instantiation of the form `Alloc<U, Args>`, where `Args`
141
- is zero or more type arguments; otherwise, the instantiation of
142
- `rebind_alloc` is ill-formed.
143
 
144
- #### Allocator traits static member functions <a id="allocator.traits.members">[[allocator.traits.members]]</a>
145
 
146
  ``` cpp
147
- static pointer allocate(Alloc& a, size_type n);
148
  ```
149
 
150
  *Returns:* `a.allocate(n)`.
151
 
152
  ``` cpp
153
- static pointer allocate(Alloc& a, size_type n, const_void_pointer hint);
154
  ```
155
 
156
  *Returns:* `a.allocate(n, hint)` if that expression is well-formed;
157
  otherwise, `a.allocate(n)`.
158
 
159
  ``` cpp
160
- static void deallocate(Alloc& a, pointer p, size_type n);
161
  ```
162
 
163
  *Effects:* Calls `a.deallocate(p, n)`.
164
 
165
  *Throws:* Nothing.
166
 
167
  ``` cpp
168
  template<class T, class... Args>
169
- static void construct(Alloc& a, T* p, Args&&... args);
170
  ```
171
 
172
  *Effects:* Calls `a.construct(p, std::forward<Args>(args)...)` if that
173
  call is well-formed; otherwise, invokes
174
- `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)`.
175
 
176
  ``` cpp
177
  template<class T>
178
- static void destroy(Alloc& a, T* p);
179
  ```
180
 
181
  *Effects:* Calls `a.destroy(p)` if that call is well-formed; otherwise,
182
- invokes `p->~T()`.
183
 
184
  ``` cpp
185
- static size_type max_size(const Alloc& a) noexcept;
186
  ```
187
 
188
  *Returns:* `a.max_size()` if that expression is well-formed; otherwise,
189
  `numeric_limits<size_type>::max()/sizeof(value_type)`.
190
 
191
  ``` cpp
192
- static Alloc select_on_container_copy_construction(const Alloc& rhs);
193
  ```
194
 
195
  *Returns:* `rhs.select_on_container_copy_construction()` if that
196
  expression is well-formed; otherwise, `rhs`.
197
 
 
28
  using is_always_equal = see below;
29
 
30
  template<class T> using rebind_alloc = see below;
31
  template<class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
32
 
33
+ [[nodiscard]] static constexpr pointer allocate(Alloc& a, size_type n);
34
+ [[nodiscard]] static constexpr pointer allocate(Alloc& a, size_type n,
35
+ const_void_pointer hint);
36
 
37
+ static constexpr void deallocate(Alloc& a, pointer p, size_type n);
38
 
39
  template<class T, class... Args>
40
+ static constexpr void construct(Alloc& a, T* p, Args&&... args);
41
 
42
  template<class T>
43
+ static constexpr void destroy(Alloc& a, T* p);
44
 
45
+ static constexpr size_type max_size(const Alloc& a) noexcept;
46
 
47
+ static constexpr Alloc select_on_container_copy_construction(const Alloc& rhs);
48
  };
49
  }
50
  ```
51
 
52
+ #### Member types <a id="allocator.traits.types">[[allocator.traits.types]]</a>
53
 
54
  ``` cpp
55
  using pointer = see below;
56
  ```
57
 
58
  *Type:* `Alloc::pointer` if the *qualified-id* `Alloc::pointer` is valid
59
+ and denotes a type [[temp.deduct]]; otherwise, `value_type*`.
60
 
61
  ``` cpp
62
  using const_pointer = see below;
63
  ```
64
 
65
  *Type:* `Alloc::const_pointer` if the *qualified-id*
66
+ `Alloc::const_pointer` is valid and denotes a type [[temp.deduct]];
67
  otherwise, `pointer_traits<pointer>::rebind<const value_type>`.
68
 
69
  ``` cpp
70
  using void_pointer = see below;
71
  ```
72
 
73
  *Type:* `Alloc::void_pointer` if the *qualified-id*
74
+ `Alloc::void_pointer` is valid and denotes a type [[temp.deduct]];
75
  otherwise, `pointer_traits<pointer>::rebind<void>`.
76
 
77
  ``` cpp
78
  using const_void_pointer = see below;
79
  ```
80
 
81
  *Type:* `Alloc::const_void_pointer` if the *qualified-id*
82
+ `Alloc::const_void_pointer` is valid and denotes a type [[temp.deduct]];
83
+ otherwise, `pointer_traits<pointer>::rebind<const void>`.
 
84
 
85
  ``` cpp
86
  using difference_type = see below;
87
  ```
88
 
89
  *Type:* `Alloc::difference_type` if the *qualified-id*
90
+ `Alloc::difference_type` is valid and denotes a type [[temp.deduct]];
91
  otherwise, `pointer_traits<pointer>::difference_type`.
92
 
93
  ``` cpp
94
  using size_type = see below;
95
  ```
96
 
97
  *Type:* `Alloc::size_type` if the *qualified-id* `Alloc::size_type` is
98
+ valid and denotes a type [[temp.deduct]]; otherwise,
99
  `make_unsigned_t<difference_type>`.
100
 
101
  ``` cpp
102
  using propagate_on_container_copy_assignment = see below;
103
  ```
104
 
105
  *Type:* `Alloc::propagate_on_container_copy_assignment` if the
106
  *qualified-id* `Alloc::propagate_on_container_copy_assignment` is valid
107
+ and denotes a type [[temp.deduct]]; otherwise `false_type`.
108
 
109
  ``` cpp
110
  using propagate_on_container_move_assignment = see below;
111
  ```
112
 
113
  *Type:* `Alloc::propagate_on_container_move_assignment` if the
114
  *qualified-id* `Alloc::propagate_on_container_move_assignment` is valid
115
+ and denotes a type [[temp.deduct]]; otherwise `false_type`.
116
 
117
  ``` cpp
118
  using propagate_on_container_swap = see below;
119
  ```
120
 
121
  *Type:* `Alloc::propagate_on_container_swap` if the *qualified-id*
122
  `Alloc::propagate_on_container_swap` is valid and denotes a
123
+ type [[temp.deduct]]; otherwise `false_type`.
124
 
125
  ``` cpp
126
  using is_always_equal = see below;
127
  ```
128
 
129
  *Type:* `Alloc::is_always_equal` if the *qualified-id*
130
+ `Alloc::is_always_equal` is valid and denotes a type [[temp.deduct]];
131
  otherwise `is_empty<Alloc>::type`.
132
 
133
  ``` cpp
134
  template<class T> using rebind_alloc = see below;
135
  ```
136
 
137
  *Alias template:* `Alloc::rebind<T>::other` if the *qualified-id*
138
+ `Alloc::rebind<T>::other` is valid and denotes a type [[temp.deduct]];
139
+ otherwise, `Alloc<T, Args>` if `Alloc` is a class template instantiation
140
+ of the form `Alloc<U, Args>`, where `Args` is zero or more type
141
+ arguments; otherwise, the instantiation of `rebind_alloc` is ill-formed.
 
142
 
143
+ #### Static member functions <a id="allocator.traits.members">[[allocator.traits.members]]</a>
144
 
145
  ``` cpp
146
+ [[nodiscard]] static constexpr pointer allocate(Alloc& a, size_type n);
147
  ```
148
 
149
  *Returns:* `a.allocate(n)`.
150
 
151
  ``` cpp
152
+ [[nodiscard]] static constexpr pointer allocate(Alloc& a, size_type n, const_void_pointer hint);
153
  ```
154
 
155
  *Returns:* `a.allocate(n, hint)` if that expression is well-formed;
156
  otherwise, `a.allocate(n)`.
157
 
158
  ``` cpp
159
+ static constexpr void deallocate(Alloc& a, pointer p, size_type n);
160
  ```
161
 
162
  *Effects:* Calls `a.deallocate(p, n)`.
163
 
164
  *Throws:* Nothing.
165
 
166
  ``` cpp
167
  template<class T, class... Args>
168
+ static constexpr void construct(Alloc& a, T* p, Args&&... args);
169
  ```
170
 
171
  *Effects:* Calls `a.construct(p, std::forward<Args>(args)...)` if that
172
  call is well-formed; otherwise, invokes
173
+ `construct_at(p, std::forward<Args>(args)...)`.
174
 
175
  ``` cpp
176
  template<class T>
177
+ static constexpr void destroy(Alloc& a, T* p);
178
  ```
179
 
180
  *Effects:* Calls `a.destroy(p)` if that call is well-formed; otherwise,
181
+ invokes `destroy_at(p)`.
182
 
183
  ``` cpp
184
+ static constexpr size_type max_size(const Alloc& a) noexcept;
185
  ```
186
 
187
  *Returns:* `a.max_size()` if that expression is well-formed; otherwise,
188
  `numeric_limits<size_type>::max()/sizeof(value_type)`.
189
 
190
  ``` cpp
191
+ static constexpr Alloc select_on_container_copy_construction(const Alloc& rhs);
192
  ```
193
 
194
  *Returns:* `rhs.select_on_container_copy_construction()` if that
195
  expression is well-formed; otherwise, `rhs`.
196