3#ifndef TETL_MEMORY_ALLOCATOR_TRAITS_HPP
4#define TETL_MEMORY_ALLOCATOR_TRAITS_HPP
13template <
typename Alloc>
14struct allocator_traits_pointer {
15 using type =
typename Alloc::value_type*;
18template <
typename Alloc>
19 requires requires {
typename Alloc::pointer; }
20struct allocator_traits_pointer<Alloc> {
21 using type =
typename Alloc::pointer;
24template <
typename Alloc>
25struct allocator_traits_const_pointer {
26 using pointer =
typename allocator_traits_pointer<Alloc>::type;
27 using type =
typename etl::pointer_traits<pointer>::template rebind<typename Alloc::value_type const>;
30template <
typename Alloc>
31 requires requires {
typename Alloc::const_pointer; }
32struct allocator_traits_const_pointer<Alloc> {
33 using type =
typename Alloc::const_pointer;
36template <
typename Alloc>
37struct allocator_traits_void_pointer {
38 using pointer =
typename allocator_traits_pointer<Alloc>::type;
39 using type =
typename etl::pointer_traits<pointer>::template rebind<void>;
42template <
typename Alloc>
43 requires requires {
typename Alloc::void_pointer; }
44struct allocator_traits_void_pointer<Alloc> {
45 using type =
typename Alloc::void_pointer;
48template <
typename Alloc>
49struct allocator_traits_const_void_pointer {
50 using pointer =
typename allocator_traits_pointer<Alloc>::type;
51 using type =
typename etl::pointer_traits<pointer>::template rebind<void const>;
54template <
typename Alloc>
55 requires requires {
typename Alloc::const_void_pointer; }
56struct allocator_traits_const_void_pointer<Alloc> {
57 using type =
typename Alloc::const_void_pointer;
60template <
typename Alloc>
61struct allocator_traits_difference_type {
62 using pointer =
typename allocator_traits_pointer<Alloc>::type;
66template <
typename Alloc>
67 requires requires {
typename Alloc::difference_type; }
68struct allocator_traits_difference_type<Alloc> {
69 using type =
typename Alloc::difference_type;
72template <
typename Alloc>
73struct allocator_traits_size_type {
74 using difference_type =
typename allocator_traits_difference_type<Alloc>::type;
78template <
typename Alloc>
79 requires requires {
typename Alloc::size_type; }
80struct allocator_traits_size_type<Alloc> {
81 using type =
typename Alloc::size_type;
86template <
typename Alloc>
90 using pointer =
typename detail::allocator_traits_pointer<Alloc>::type;
91 using const_pointer =
typename detail::allocator_traits_const_pointer<Alloc>::type;
92 using void_pointer =
typename detail::allocator_traits_void_pointer<Alloc>::type;
94 using difference_type =
typename detail::allocator_traits_difference_type<Alloc>::type;
95 using size_type =
typename detail::allocator_traits_size_type<Alloc>::type;
97 [[nodiscard]]
static constexpr auto allocate(Alloc& a,
size_type n) {
return a.allocate(n); }
Definition adjacent_find.hpp:8
typename make_unsigned< T >::type make_unsigned_t
Definition make_unsigned.hpp:75
Definition allocator_traits.hpp:87
typename detail::allocator_traits_const_pointer< Alloc >::type const_pointer
Definition allocator_traits.hpp:91
typename detail::allocator_traits_const_void_pointer< Alloc >::type const_void_pointer
Definition allocator_traits.hpp:93
typename Alloc::value_type value_type
Definition allocator_traits.hpp:89
typename detail::allocator_traits_void_pointer< Alloc >::type void_pointer
Definition allocator_traits.hpp:92
static constexpr auto allocate(Alloc &a, size_type n)
Definition allocator_traits.hpp:97
static constexpr void deallocate(Alloc &a, pointer p, size_type n)
Definition allocator_traits.hpp:99
Alloc allocator_type
Definition allocator_traits.hpp:88
typename detail::allocator_traits_size_type< Alloc >::type size_type
Definition allocator_traits.hpp:95
typename detail::allocator_traits_pointer< Alloc >::type pointer
Definition allocator_traits.hpp:90
typename detail::allocator_traits_difference_type< Alloc >::type difference_type
Definition allocator_traits.hpp:94
typename Ptr::difference_type difference_type
Definition pointer_traits.hpp:20