Skip to content

Commit 87ce25b

Browse files
committed
expanded format
1 parent f70fe15 commit 87ce25b

41 files changed

Lines changed: 829 additions & 1124 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/standard-library/allocator-class.md

Lines changed: 58 additions & 68 deletions
Large diffs are not rendered by default.

docs/standard-library/allocator-traits-class.md

Lines changed: 51 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,41 @@ The template class describes an object that supplements an *allocator type*. An
1313

1414
```cpp
1515
template <class Alloc>
16-
class allocator_traits;
16+
class allocator_traits;
1717
```
1818

19+
## Members
20+
1921
### Typedefs
2022

21-
|Name|Description|
22-
|----------|-----------------|
23-
|`allocator_traits::allocator_type`|This type is a synonym for the template parameter `Alloc`.|
24-
|`allocator_traits::const_pointer`|This type is `Alloc::const_pointer`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::rebind<const value_type>`.|
25-
|`allocator_traits::const_void_pointer`|This type is `Alloc::const_void_pointer`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::rebind<const void>`.|
26-
|`allocator_traits::difference_type`|This type is `Alloc::difference_type`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::difference_type`.|
27-
|`allocator_traits::pointer`|This type is `Alloc::pointer`, if that type is well-formed; otherwise, this type is `value_type *`.|
28-
|`allocator_traits::propagate_on_container_copy_assignment`|This type is `Alloc::propagate_on_container_copy_assignment`, if that type is well-formed; otherwise, this type is `false_type`.|
29-
|`allocator_traits::propagate_on_container_move_assignment`|This type is `Alloc::propagate_on_container_move_assignment`, if that type is well-formed; otherwise, this type is `false_type`. If the type holds true, an allocator-enabled container copies its stored allocator on a move assignment.|
30-
|`allocator_traits::propagate_on_container_swap`|This type is `Alloc::propagate_on_container_swap`, if that type is well-formed; otherwise, this type is `false_type`. If the type holds true, an allocator-enabled container swaps its stored allocator on a swap.|
31-
|`allocator_traits::size_type`|This type is `Alloc::size_type`, if that type is well-formed; otherwise, this type is `make_unsigned<difference_type>::type`.|
32-
|`allocator_traits::value_type`|This type is a synonym for `Alloc::value_type`.|
33-
|`allocator_traits::void_pointer`|This type is `Alloc::void_pointer`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::rebind<void>`.|
23+
|||
24+
|-|-|
25+
|`allocator_type`|This type is a synonym for the template parameter `Alloc`.|
26+
|`const_pointer`|This type is `Alloc::const_pointer`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::rebind<const value_type>`.|
27+
|`const_void_pointer`|This type is `Alloc::const_void_pointer`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::rebind<const void>`.|
28+
|`difference_type`|This type is `Alloc::difference_type`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::difference_type`.|
29+
|`pointer`|This type is `Alloc::pointer`, if that type is well-formed; otherwise, this type is `value_type *`.|
30+
|`propagate_on_container_copy_assignment`|This type is `Alloc::propagate_on_container_copy_assignment`, if that type is well-formed; otherwise, this type is `false_type`.|
31+
|`propagate_on_container_move_assignment`|This type is `Alloc::propagate_on_container_move_assignment`, if that type is well-formed; otherwise, this type is `false_type`. If the type holds true, an allocator-enabled container copies its stored allocator on a move assignment.|
32+
|`propagate_on_container_swap`|This type is `Alloc::propagate_on_container_swap`, if that type is well-formed; otherwise, this type is `false_type`. If the type holds true, an allocator-enabled container swaps its stored allocator on a swap.|
33+
|`size_type`|This type is `Alloc::size_type`, if that type is well-formed; otherwise, this type is `make_unsigned<difference_type>::type`.|
34+
|`value_type`|This type is a synonym for `Alloc::value_type`.|
35+
|`void_pointer`|This type is `Alloc::void_pointer`, if that type is well-formed; otherwise, this type is `pointer_traits<pointer>::rebind<void>`.|
3436

3537
### Static Methods
3638

3739
The following static methods call the corresponding method on a given allocator parameter.
3840

39-
|Name|Description|
40-
|----------|-----------------|
41+
|||
42+
|-|-|
4143
|[allocate](#allocate)|Static method that allocates memory by using the given allocator parameter.|
4244
|[construct](#construct)|Static method that uses a specified allocator to construct an object.|
4345
|[deallocate](#deallocate)|Static method that uses a specified allocator to deallocate a specified number of objects.|
4446
|[destroy](#destroy)|Static method that uses a specified allocator to call the destructor on an object without deallocating its memory.|
4547
|[max_size](#max_size)|Static method that uses a specified allocator to determine the maximum number of objects that can be allocated.|
4648
|[select_on_container_copy_construction](#select_on_container_copy_construction)|Static method that calls `select_on_container_copy_construction` on the specified allocator.|
4749

48-
## Requirements
49-
50-
**Header:** \<memory>
51-
52-
**Namespace:** std
53-
54-
## <a name="allocate"></a> allocator_traits::allocate
50+
### <a name="allocate"></a> allocate
5551

5652
Static method that allocates memory by using the given allocator parameter.
5753

@@ -62,26 +58,26 @@ static pointer allocate(Alloc& al, size_type count,
6258
typename allocator_traits<void>::const_pointer* hint);
6359
```
6460
65-
### Parameters
61+
#### Parameters
6662
67-
*al*<br/>
63+
*al*\
6864
An allocator object.
6965
70-
*count*<br/>
66+
*count*\
7167
The number of elements to allocate.
7268
73-
*hint*<br/>
69+
*hint*\
7470
A `const_pointer` that might assist the allocator object in satisfying the request for storage by locating the address of an allocated object prior to the request. A null pointer is treated as no hint.
7571
76-
### Return Value
72+
#### Return Value
7773
7874
Each method returns a pointer to the allocated object.
7975
8076
The first static method returns `al.allocate(count)`.
8177
8278
The second method returns `al.allocate(count, hint)`, if that expression is well formed; otherwise it returns `al.allocate(count)`.
8379
84-
## <a name="construct"></a> allocator_traits::construct
80+
### <a name="construct"></a> construct
8581
8682
Static method that uses a specified allocator to construct an object.
8783
@@ -90,22 +86,22 @@ template <class Uty, class Types>
9086
static void construct(Alloc& al, Uty* ptr, Types&&... args);
9187
```
9288

93-
### Parameters
89+
#### Parameters
9490

95-
*al*<br/>
91+
*al*\
9692
An allocator object.
9793

98-
*ptr*<br/>
94+
*ptr*\
9995
A pointer to the location where the object is to be constructed.
10096

101-
*args*<br/>
97+
*args*\
10298
A list of arguments that is passed to the object constructor.
10399

104-
### Remarks
100+
#### Remarks
105101

106102
The static member function calls `al.construct(ptr, args...)`, if that expression is well formed; otherwise it evaluates `::new (static_cast<void *>(ptr)) Uty(std::forward<Types>(args)...)`.
107103

108-
## <a name="deallocate"></a> allocator_traits::deallocate
104+
### <a name="deallocate"></a> deallocate
109105

110106
Static method that uses a specified allocator to deallocate a specified number of objects.
111107

@@ -115,84 +111,78 @@ static void deallocate(Alloc al,
115111
size_type count);
116112
```
117113
118-
### Parameters
114+
#### Parameters
119115
120-
*al*<br/>
116+
*al*\
121117
An allocator object.
122118
123-
*ptr*<br/>
119+
*ptr*\
124120
A pointer to the starting location of the objects to be deallocated.
125121
126-
*count*<br/>
122+
*count*\
127123
The number of objects to deallocate.
128124
129-
### Remarks
125+
#### Remarks
130126
131127
This method calls `al.deallocate(ptr, count)`.
132128
133129
This method throws nothing.
134130
135-
## <a name="destroy"></a> allocator_traits::destroy
131+
### <a name="destroy"></a> destroy
136132
137133
Static method that uses a specified allocator to call the destructor on an object without deallocating its memory.
138134
139135
```cpp
140136
template <class Uty>
141-
static void destroy(Alloc& al, Uty* ptr);
137+
static void destroy(Alloc& al, Uty* ptr);
142138
```
143139

144-
### Parameters
140+
#### Parameters
145141

146-
*al*<br/>
142+
*al*\
147143
An allocator object.
148144

149-
*ptr*<br/>
145+
*ptr*\
150146
A pointer to the location of the object.
151147

152-
### Remarks
148+
#### Remarks
153149

154150
This method calls `al.destroy(ptr)`, if that expression is well formed; otherwise it evaluates `ptr->~Uty()`.
155151

156-
## <a name="max_size"></a> allocator_traits::max_size
152+
### <a name="max_size"></a> max_size
157153

158154
Static method that uses a specified allocator to determine the maximum number of objects that can be allocated.
159155

160156
```cpp
161157
static size_type max_size(const Alloc& al);
162158
```
163159
164-
### Parameters
160+
#### Parameters
165161
166-
*al*<br/>
162+
*al*\
167163
An allocator object.
168164
169-
### Remarks
165+
#### Remarks
170166
171167
This method returns `al.max_size()`, if that expression is well formed; otherwise it returns `numeric_limits<size_type>::max()`.
172168
173-
## <a name="select_on_container_copy_construction"></a> allocator_traits::select_on_container_copy_construction
169+
### <a name="select_on_container_copy_construction"></a> select_on_container_copy_construction
174170
175171
Static method that calls `select_on_container_copy_construction` on the specified allocator.
176172
177173
```cpp
178174
static Alloc select_on_container_copy_construction(const Alloc& al);
179175
```
180176

181-
### Parameters
177+
#### Parameters
182178

183-
*al*<br/>
179+
*al*\
184180
An allocator object.
185181

186-
### Return Value
182+
#### Return Value
187183

188184
This method returns `al.select_on_container_copy_construction()`, if that type is well formed; otherwise it returns *al*.
189185

190-
### Remarks
186+
#### Remarks
191187

192188
This method is used to specify an allocator when the associated container is copy-constructed.
193-
194-
## See also
195-
196-
[\<memory>](../standard-library/memory.md)<br/>
197-
[pointer_traits Struct](../standard-library/pointer-traits-struct.md)<br/>
198-
[scoped_allocator_adaptor Class](../standard-library/scoped-allocator-adaptor-class.md)<br/>

docs/standard-library/allocator-void-class.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,3 @@ The class explicitly specializes template class [allocator](../standard-library/
4141
- [value_type](../standard-library/allocator-class.md#value_type).
4242
4343
- [rebind](../standard-library/allocator-class.md#rebind), a nested template class.
44-
45-
## Requirements
46-
47-
**Header:** \<memory>
48-
49-
**Namespace:** std
50-
51-
## See also
52-
53-
[Thread Safety in the C++ Standard Library](../standard-library/thread-safety-in-the-cpp-standard-library.md)<br/>

0 commit comments

Comments
 (0)