From Jason Turner

[depr.default.allocator]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp7ibhirfu/{from.md → to.md} +86 -0
tmp/tmp7ibhirfu/{from.md → to.md} RENAMED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## The default allocator <a id="depr.default.allocator">[[depr.default.allocator]]</a>
2
+
3
+ The following members and explicit class template specialization are
4
+ defined in addition to those specified in [[default.allocator]]:
5
+
6
+ ``` cpp
7
+ namespace std {
8
+ // specialize for void:
9
+ template <> class allocator<void> {
10
+ public:
11
+ using value_type = void;
12
+ using pointer = void*;
13
+ using const_pointer = const void*;
14
+ // reference-to-void members are impossible.
15
+
16
+ template <class U> struct rebind { using other = allocator<U>; };
17
+ };
18
+
19
+ template <class T> class allocator {
20
+ public:
21
+ using size_type = size_t;
22
+ using difference_type = ptrdiff_t;
23
+ using pointer = T*;
24
+ using const_pointer = const T*;
25
+ using reference = T&;
26
+ using const_reference = const T&;
27
+ template <class U> struct rebind { using other = allocator<U>; };
28
+
29
+ T* address(T& x) const noexcept;
30
+ const T* address(const T& x) const noexcept;
31
+
32
+ T* allocate(size_t n, const void* hint);
33
+
34
+ template<class U, class... Args>
35
+ void construct(U* p, Args&&... args);
36
+ template <class U>
37
+ void destroy(U* p);
38
+
39
+ size_t max_size() const noexcept;
40
+ };
41
+ }
42
+ ```
43
+
44
+ ``` cpp
45
+ T* address(T& x) const noexcept;
46
+ const T* address(const T& x) const noexcept;
47
+ ```
48
+
49
+ *Returns:* `addressof(x)`.
50
+
51
+ ``` cpp
52
+ T* allocate(size_t n, const void* hint);
53
+ ```
54
+
55
+ *Returns:* A pointer to the initial element of an array of storage of
56
+ size `n` `* sizeof(T)`, aligned appropriately for objects of type `T`.
57
+ It is *implementation-defined* whether over-aligned types are
58
+ supported ([[basic.align]]).
59
+
60
+ *Remarks:* The storage is obtained by calling
61
+ `::operator new(std::size_t)` ([[new.delete]]), but it is unspecified
62
+ when or how often this function is called.
63
+
64
+ *Throws:* `bad_alloc` if the storage cannot be obtained.
65
+
66
+ ``` cpp
67
+ template <class U, class... Args>
68
+ void construct(U* p, Args&&... args);
69
+ ```
70
+
71
+ *Effects:* As if by: `::new((void *)p) U(std::forward<Args>(args)...);`
72
+
73
+ ``` cpp
74
+ template <class U>
75
+ void destroy(U* p);
76
+ ```
77
+
78
+ *Effects:* As if by `p->~U()`.
79
+
80
+ ``` cpp
81
+ size_t max_size() const noexcept;
82
+ ```
83
+
84
+ *Returns:* The largest value *N* for which the call `allocate(N, 0)`
85
+ might succeed.
86
+