]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/core/allocator_traits.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / core / allocator_traits.hpp
1 /*
2 Copyright 2021 Glen Joseph Fernandes
3 (glenjofe@gmail.com)
4
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
7 */
8 #ifndef BOOST_CORE_ALLOCATOR_TRAITS_HPP
9 #define BOOST_CORE_ALLOCATOR_TRAITS_HPP
10
11 #include <boost/core/allocator_access.hpp>
12
13 namespace boost {
14
15 template<class A>
16 struct allocator_traits {
17 typedef A allocator_type;
18
19 typedef typename allocator_value_type<A>::type value_type;
20
21 typedef typename allocator_pointer<A>::type pointer;
22
23 typedef typename allocator_const_pointer<A>::type const_pointer;
24
25 typedef typename allocator_void_pointer<A>::type void_pointer;
26
27 typedef typename allocator_const_void_pointer<A>::type const_void_pointer;
28
29 typedef typename allocator_difference_type<A>::type difference_type;
30
31 typedef typename allocator_size_type<A>::type size_type;
32
33 typedef typename allocator_propagate_on_container_copy_assignment<A>::type
34 propagate_on_container_copy_assignment;
35
36 typedef typename allocator_propagate_on_container_move_assignment<A>::type
37 propagate_on_container_move_assignment;
38
39 typedef typename allocator_propagate_on_container_swap<A>::type
40 propagate_on_container_swap;
41
42 typedef typename allocator_is_always_equal<A>::type is_always_equal;
43
44 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
45 template<class T>
46 using rebind_traits = allocator_traits<typename
47 allocator_rebind<A, T>::type>;
48 #else
49 template<class T>
50 struct rebind_traits
51 : allocator_traits<typename allocator_rebind<A, T>::type> { };
52 #endif
53
54 static pointer allocate(A& a, size_type n) {
55 return boost::allocator_allocate(a, n);
56 }
57
58 static pointer allocate(A& a, size_type n, const_void_pointer h) {
59 return boost::allocator_allocate(a, n, h);
60 }
61
62 static void deallocate(A& a, pointer p, size_type n) {
63 return boost::allocator_deallocate(a, p, n);
64 }
65
66 template<class T>
67 static void construct(A& a, T* p) {
68 boost::allocator_construct(a, p);
69 }
70
71 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
72 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
73 template<class T, class V, class... Args>
74 static void construct(A& a, T* p, V&& v, Args&&... args) {
75 boost::allocator_construct(a, p, std::forward<V>(v),
76 std::forward<Args>(args)...);
77 }
78 #else
79 template<class T, class V>
80 static void construct(A& a, T* p, V&& v) {
81 boost::allocator_construct(a, p, std::forward<V>(v));
82 }
83 #endif
84 #else
85 template<class T, class V>
86 static void construct(A& a, T* p, const V& v) {
87 boost::allocator_construct(a, p, v);
88 }
89
90 template<class T, class V>
91 static void construct(A& a, T* p, V& v) {
92 boost::allocator_construct(a, p, v);
93 }
94 #endif
95
96 template<class T>
97 static void destroy(A& a, T* p) {
98 boost::allocator_destroy(a, p);
99 }
100
101 static size_type max_size(const A& a) BOOST_NOEXCEPT {
102 return boost::allocator_max_size(a);
103 }
104
105 static A select_on_container_copy_construction(const A& a) {
106 return boost::allocator_select_on_container_copy_construction(a);
107 }
108 };
109
110 } /* boost */
111
112 #endif