From Jason Turner

[allocator.traits.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpv07x4zvf/{from.md → to.md} +56 -0
tmp/tmpv07x4zvf/{from.md → to.md} RENAMED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### General <a id="allocator.traits.general">[[allocator.traits.general]]</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
+ If a program declares an explicit or partial specialization of
11
+ `allocator_traits`, the program is ill-formed, no diagnostic required.
12
+
13
+ ``` cpp
14
+ namespace std {
15
+ template<class Alloc> struct allocator_traits {
16
+ using allocator_type = Alloc;
17
+
18
+ using value_type = typename Alloc::value_type;
19
+
20
+ using pointer = see below;
21
+ using const_pointer = see below;
22
+ using void_pointer = see below;
23
+ using const_void_pointer = see below;
24
+
25
+ using difference_type = see below;
26
+ using size_type = see below;
27
+
28
+ using propagate_on_container_copy_assignment = see below;
29
+ using propagate_on_container_move_assignment = see below;
30
+ using propagate_on_container_swap = see below;
31
+ using is_always_equal = see below;
32
+
33
+ template<class T> using rebind_alloc = see below;
34
+ template<class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
35
+
36
+ [[nodiscard]] static constexpr pointer allocate(Alloc& a, size_type n);
37
+ [[nodiscard]] static constexpr pointer allocate(Alloc& a, size_type n,
38
+ const_void_pointer hint);
39
+ [[nodiscard]] static constexpr allocation_result<pointer, size_type>
40
+ allocate_at_least(Alloc& a, size_type n);
41
+
42
+ static constexpr void deallocate(Alloc& a, pointer p, size_type n);
43
+
44
+ template<class T, class... Args>
45
+ static constexpr void construct(Alloc& a, T* p, Args&&... args);
46
+
47
+ template<class T>
48
+ static constexpr void destroy(Alloc& a, T* p);
49
+
50
+ static constexpr size_type max_size(const Alloc& a) noexcept;
51
+
52
+ static constexpr Alloc select_on_container_copy_construction(const Alloc& rhs);
53
+ };
54
+ }
55
+ ```
56
+