File indexing completed on 2025-01-18 09:30:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
0011 #define BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
0012
0013 #ifndef BOOST_CONFIG_HPP
0014 # include <boost/config.hpp>
0015 #endif
0016
0017 #if defined(BOOST_HAS_PRAGMA_ONCE)
0018 # pragma once
0019 #endif
0020
0021 #include <boost/container/allocator_traits.hpp>
0022 #include <boost/container/container_fwd.hpp>
0023
0024
0025 namespace boost {
0026 namespace container {
0027 namespace dtl {
0028
0029 template <class Cont, class U>
0030 struct container_rebind;
0031
0032 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0033
0034 template <template <class, class, class...> class Cont, typename V, typename A, class... An, class U>
0035 struct container_rebind<Cont<V, A, An...>, U>
0036 {
0037 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, An...> type;
0038 };
0039
0040
0041 template <template <class, class> class Cont, typename V, typename A, class U>
0042 struct container_rebind<Cont<V, A>, U>
0043 {
0044 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
0045 };
0046
0047 template <template <class> class Cont, typename V, class U>
0048 struct container_rebind<Cont<V>, U>
0049 {
0050 typedef Cont<U> type;
0051 };
0052
0053 #else
0054
0055 template <template <class> class Cont
0056 , typename V
0057 , class U>
0058 struct container_rebind<Cont<V>, U>
0059 {
0060 typedef Cont<U> type;
0061 };
0062
0063 template <template <class, class> class Cont
0064 , typename V, typename A
0065 , class U>
0066 struct container_rebind<Cont<V, A>, U>
0067 {
0068 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
0069 };
0070
0071 template <template <class, class, class> class Cont
0072 , typename V, typename A, class P0
0073 , class U>
0074 struct container_rebind<Cont<V, A, P0>, U>
0075 {
0076 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0> type;
0077 };
0078
0079 template <template <class, class, class, class> class Cont
0080 , typename V, typename A, class P0, class P1
0081 , class U>
0082 struct container_rebind<Cont<V, A, P0, P1>, U>
0083 {
0084 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1> type;
0085 };
0086
0087 template <template <class, class, class, class, class> class Cont
0088 , typename V, typename A, class P0, class P1, class P2
0089 , class U>
0090 struct container_rebind<Cont<V, A, P0, P1, P2>, U>
0091 {
0092 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2> type;
0093 };
0094
0095 template <template <class, class, class, class, class, class> class Cont
0096 , typename V, typename A, class P0, class P1, class P2, class P3
0097 , class U>
0098 struct container_rebind<Cont<V, A, P0, P1, P2, P3>, U>
0099 {
0100 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type;
0101 };
0102
0103 template <template <class, class, class, class, class, class, class> class Cont
0104 , typename V, typename A, class P0, class P1, class P2, class P3, class P4
0105 , class U>
0106 struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4>, U>
0107 {
0108 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type;
0109 };
0110
0111 template <template <class, class, class, class, class, class, class, class> class Cont
0112 , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5
0113 , class U>
0114 struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5>, U>
0115 {
0116 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type;
0117 };
0118
0119 template <template <class, class, class, class, class, class, class, class, class> class Cont
0120 , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
0121 , class U>
0122 struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U>
0123 {
0124 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type;
0125 };
0126
0127 template <template <class, class, class, class, class, class, class, class, class, class> class Cont
0128 , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
0129 , class U>
0130 struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
0131 {
0132 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
0133 };
0134
0135 template <template <class, class, class, class, class, class, class, class, class, class, class> class Cont
0136 , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
0137 , class U>
0138 struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
0139 {
0140 typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
0141 };
0142
0143 #endif
0144
0145
0146
0147 template <typename V, std::size_t N, typename A, typename O, class U>
0148 struct container_rebind<small_vector<V, N, A, O>, U>
0149 {
0150 typedef small_vector<U, N, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, O> type;
0151 };
0152
0153 template <typename V, std::size_t N, typename O, class U>
0154 struct container_rebind<static_vector<V, N, O>, U>
0155 {
0156 typedef static_vector<U, N, O> type;
0157 };
0158
0159 }
0160 }
0161 }
0162
0163 #endif