From Jason Turner

[allocator.traits]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpz47qoczo/{from.md → to.md} +68 -46
tmp/tmpz47qoczo/{from.md → to.md} RENAMED
@@ -1,30 +1,33 @@
1
  ### Allocator traits <a id="allocator.traits">[[allocator.traits]]</a>
2
 
3
  The class template `allocator_traits` supplies a uniform interface to
4
  all allocator types. An allocator cannot be a non-class type, however,
5
- even if `allocator_traits` supplies the entire required interface. Thus,
6
- it is always possible to create a derived class from an allocator.
 
 
7
 
8
  ``` cpp
9
  namespace std {
10
  template <class Alloc> struct allocator_traits {
11
- typedef Alloc allocator_type;
12
 
13
- typedef typename Alloc::value_type value_type;
14
 
15
- typedef see below pointer;
16
- typedef see below const_pointer;
17
- typedef see below void_pointer;
18
- typedef see below const_void_pointer;
19
 
20
- typedef see below difference_type;
21
- typedef see below size_type;
22
 
23
- typedef see below propagate_on_container_copy_assignment;
24
- typedef see below propagate_on_container_move_assignment;
25
- typedef see below propagate_on_container_swap;
 
26
 
27
  template <class T> using rebind_alloc = see below;
28
  template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
29
 
30
  static pointer allocate(Alloc& a, size_type n);
@@ -46,80 +49,99 @@ namespace std {
46
  ```
47
 
48
  #### Allocator traits member types <a id="allocator.traits.types">[[allocator.traits.types]]</a>
49
 
50
  ``` cpp
51
- typedef see below pointer;
52
  ```
53
 
54
- *Type:* `Alloc::pointer` if such a type exists; otherwise,
55
- `value_type*`.
56
 
57
  ``` cpp
58
- typedef see below const_pointer;
59
  ```
60
 
61
- *Type:* `Alloc::const_pointer` if such a type exists; otherwise,
62
- `pointer_traits<pointer>::rebind<const value_type>`.
 
63
 
64
  ``` cpp
65
- typedef see below void_pointer;
66
  ```
67
 
68
- *Type:* `Alloc::void_pointer` if such a type exists; otherwise,
69
- `pointer_traits<pointer>::rebind<void>`.
 
70
 
71
  ``` cpp
72
- typedef see below const_void_pointer;
73
  ```
74
 
75
- *Type:* `Alloc::const_void_pointer` if such a type exists; otherwise,
 
 
76
  `pointer_traits<pointer>::rebind<const void>`.
77
 
78
  ``` cpp
79
- typedef see below difference_type;
80
  ```
81
 
82
- *Type:* `Alloc::difference_type` if such a type exists; otherwise,
83
- `pointer_traits<pointer>::difference_type`.
 
84
 
85
  ``` cpp
86
- typedef see below size_type;
87
  ```
88
 
89
- *Type:* `Alloc::size_type` if such a type exists; otherwise,
 
90
  `make_unsigned_t<difference_type>`.
91
 
92
  ``` cpp
93
- typedef see below propagate_on_container_copy_assignment;
94
  ```
95
 
96
- *Type:* `Alloc::propagate_on_container_copy_assignment` if such a type
97
- exists, otherwise `false_type`.
 
98
 
99
  ``` cpp
100
- typedef see below propagate_on_container_move_assignment;
101
  ```
102
 
103
- *Type:* `Alloc::propagate_on_container_move_assignment` if such a type
104
- exists, otherwise `false_type`.
 
105
 
106
  ``` cpp
107
- typedef see below propagate_on_container_swap;
108
  ```
109
 
110
- *Type:* `Alloc::propagate_on_container_swap` if such a type exists,
111
- otherwise `false_type`.
 
 
 
 
 
 
 
 
 
112
 
113
  ``` cpp
114
  template <class T> using rebind_alloc = see below;
115
  ```
116
 
117
- *Alias template:* `Alloc::rebind<T>::other` if such a type exists;
118
- otherwise, `Alloc<T, Args>` if `Alloc` is a class template instantiation
119
- of the form `Alloc<U, Args>`, where `Args` is zero or more type
120
- arguments; otherwise, the instantiation of `rebind_alloc` is ill-formed.
 
 
121
 
122
  #### Allocator traits static member functions <a id="allocator.traits.members">[[allocator.traits.members]]</a>
123
 
124
  ``` cpp
125
  static pointer allocate(Alloc& a, size_type n);
@@ -136,37 +158,37 @@ otherwise, `a.allocate(n)`.
136
 
137
  ``` cpp
138
  static void deallocate(Alloc& a, pointer p, size_type n);
139
  ```
140
 
141
- *Effects:* calls `a.deallocate(p, n)`.
142
 
143
  *Throws:* Nothing.
144
 
145
  ``` cpp
146
  template <class T, class... Args>
147
  static void construct(Alloc& a, T* p, Args&&... args);
148
  ```
149
 
150
- *Effects:* calls `a.construct(p, std::forward<Args>(args)...)` if that
151
  call is well-formed; otherwise, invokes
152
  `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)`.
153
 
154
  ``` cpp
155
  template <class T>
156
  static void destroy(Alloc& a, T* p);
157
  ```
158
 
159
- *Effects:* calls `a.destroy(p)` if that call is well-formed; otherwise,
160
  invokes `p->~T()`.
161
 
162
  ``` cpp
163
  static size_type max_size(const Alloc& a) noexcept;
164
  ```
165
 
166
  *Returns:* `a.max_size()` if that expression is well-formed; otherwise,
167
- `numeric_limits<size_type>::max()`.
168
 
169
  ``` cpp
170
  static Alloc select_on_container_copy_construction(const Alloc& rhs);
171
  ```
172
 
 
1
  ### Allocator traits <a id="allocator.traits">[[allocator.traits]]</a>
2
 
3
  The class template `allocator_traits` supplies a uniform interface to
4
  all allocator types. An allocator cannot be a non-class type, however,
5
+ even if `allocator_traits` supplies the entire required interface.
6
+
7
+ [*Note 1*: Thus, it is always possible to create a derived class from
8
+ an allocator. — *end note*]
9
 
10
  ``` cpp
11
  namespace std {
12
  template <class Alloc> struct allocator_traits {
13
+ using allocator_type = Alloc;
14
 
15
+ using value_type = typename Alloc::value_type;
16
 
17
+ using pointer = see below;
18
+ using const_pointer = see below;
19
+ using void_pointer = see below;
20
+ using const_void_pointer = see below;
21
 
22
+ using difference_type = see below;
23
+ using size_type = see below;
24
 
25
+ using propagate_on_container_copy_assignment = see below;
26
+ using propagate_on_container_move_assignment = see below;
27
+ using propagate_on_container_swap = see below;
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);
 
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);
 
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