34 lines
2.2 KiB
Markdown
34 lines
2.2 KiB
Markdown
[allocator.traits.general]
|
|
|
|
# 20 Memory management library [[mem]](./#mem)
|
|
|
|
## 20.2 Memory [[memory]](memory#allocator.traits.general)
|
|
|
|
### 20.2.9 Allocator traits [[allocator.traits]](allocator.traits#general)
|
|
|
|
#### 20.2.9.1 General [allocator.traits.general]
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L1640)
|
|
|
|
The class template allocator_traits supplies a uniform interface to all
|
|
allocator types[.](#1.sentence-1)
|
|
|
|
An allocator cannot be a non-class type, however, even if allocator_traits supplies the entire required interface[.](#1.sentence-2)
|
|
|
|
[*Note [1](#note-1)*:
|
|
|
|
Thus, it is always possible to create
|
|
a derived class from an allocator[.](#1.sentence-3)
|
|
|
|
â *end note*]
|
|
|
|
If a program declares
|
|
an explicit or partial specialization of allocator_traits,
|
|
the program is ill-formed, no diagnostic required[.](#1.sentence-4)
|
|
|
|
[ð](#lib:allocator_traits)
|
|
|
|
namespace std {template<class Alloc> struct allocator_traits {using allocator_type = Alloc; using value_type = typename Alloc::value_type; using pointer = *see below*; using const_pointer = *see below*; using void_pointer = *see below*; using const_void_pointer = *see below*; using difference_type = *see below*; using size_type = *see below*; using propagate_on_container_copy_assignment = *see below*; using propagate_on_container_move_assignment = *see below*; using propagate_on_container_swap = *see below*; using is_always_equal = *see below*; template<class T> using rebind_alloc = *see below*; template<class T> using rebind_traits = allocator_traits<rebind_alloc<T>>; static constexpr pointer allocate(Alloc& a, size_type n); static constexpr pointer allocate(Alloc& a, size_type n, const_void_pointer hint); static constexpr allocation_result<pointer, size_type> allocate_at_least(Alloc& a, size_type n); static constexpr void deallocate(Alloc& a, pointer p, size_type n); template<class T, class... Args>static constexpr void construct(Alloc& a, T* p, Args&&... args); template<class T>static constexpr void destroy(Alloc& a, T* p); static constexpr size_type max_size(const Alloc& a) noexcept; static constexpr Alloc select_on_container_copy_construction(const Alloc& rhs); };}
|