Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:29

0001 /*
0002 Copyright 2021 Glen Joseph Fernandes
0003 (glenjofe@gmail.com)
0004 
0005 Distributed under the Boost Software License, Version 1.0.
0006 (http://www.boost.org/LICENSE_1_0.txt)
0007 */
0008 #ifndef BOOST_CORE_ALLOCATOR_TRAITS_HPP
0009 #define BOOST_CORE_ALLOCATOR_TRAITS_HPP
0010 
0011 #include <boost/core/allocator_access.hpp>
0012 
0013 namespace boost {
0014 
0015 template<class A>
0016 struct allocator_traits {
0017     typedef A allocator_type;
0018 
0019     typedef typename allocator_value_type<A>::type value_type;
0020 
0021     typedef typename allocator_pointer<A>::type pointer;
0022 
0023     typedef typename allocator_const_pointer<A>::type const_pointer;
0024 
0025     typedef typename allocator_void_pointer<A>::type void_pointer;
0026 
0027     typedef typename allocator_const_void_pointer<A>::type const_void_pointer;
0028 
0029     typedef typename allocator_difference_type<A>::type difference_type;
0030 
0031     typedef typename allocator_size_type<A>::type size_type;
0032 
0033     typedef typename allocator_propagate_on_container_copy_assignment<A>::type
0034         propagate_on_container_copy_assignment;
0035 
0036     typedef typename allocator_propagate_on_container_move_assignment<A>::type
0037         propagate_on_container_move_assignment;
0038 
0039     typedef typename allocator_propagate_on_container_swap<A>::type
0040         propagate_on_container_swap;
0041 
0042     typedef typename allocator_is_always_equal<A>::type is_always_equal;
0043 
0044 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0045     template<class T>
0046     using rebind_traits = allocator_traits<typename
0047         allocator_rebind<A, T>::type>;
0048 #else
0049     template<class T>
0050     struct rebind_traits
0051         : allocator_traits<typename allocator_rebind<A, T>::type> { };
0052 #endif
0053 
0054     static pointer allocate(A& a, size_type n) {
0055         return boost::allocator_allocate(a, n);
0056     }
0057 
0058     static pointer allocate(A& a, size_type n, const_void_pointer h) {
0059         return boost::allocator_allocate(a, n, h);
0060     }
0061 
0062     static void deallocate(A& a, pointer p, size_type n) {
0063         return boost::allocator_deallocate(a, p, n);
0064     }
0065 
0066     template<class T>
0067     static void construct(A& a, T* p) {
0068         boost::allocator_construct(a, p);
0069     }
0070 
0071 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0072 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0073     template<class T, class V, class... Args>
0074     static void construct(A& a, T* p, V&& v, Args&&... args) {
0075         boost::allocator_construct(a, p, std::forward<V>(v),
0076             std::forward<Args>(args)...);
0077     }
0078 #else
0079     template<class T, class V>
0080     static void construct(A& a, T* p, V&& v) {
0081         boost::allocator_construct(a, p, std::forward<V>(v));
0082     }
0083 #endif
0084 #else
0085     template<class T, class V>
0086     static void construct(A& a, T* p, const V& v) {
0087         boost::allocator_construct(a, p, v);
0088     }
0089 
0090     template<class T, class V>
0091     static void construct(A& a, T* p, V& v) {
0092         boost::allocator_construct(a, p, v);
0093     }
0094 #endif
0095 
0096     template<class T>
0097     static void destroy(A& a, T* p) {
0098         boost::allocator_destroy(a, p);
0099     }
0100 
0101     static size_type max_size(const A& a) BOOST_NOEXCEPT {
0102         return boost::allocator_max_size(a);
0103     }
0104 
0105     static A select_on_container_copy_construction(const A& a) {
0106         return boost::allocator_select_on_container_copy_construction(a);
0107     }
0108 };
0109 
0110 } /* boost */
0111 
0112 #endif