@@ -26,6 +26,16 @@ namespace boost {
26
26
namespace container {
27
27
namespace dtl {
28
28
29
+ template <class V , class A , class U >
30
+ struct void_or_portable_rebind_alloc
31
+ {
32
+ typedef typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type type;
33
+ };
34
+
35
+ template <class V , class U >
36
+ struct void_or_portable_rebind_alloc <V, void , U>
37
+ { typedef void type; };
38
+
29
39
template <class Cont , class U >
30
40
struct container_rebind ;
31
41
@@ -34,14 +44,14 @@ namespace dtl {
34
44
template <template <class , class , class ...> class Cont , typename V, typename A, class ... An, class U >
35
45
struct container_rebind <Cont<V, A, An...>, U>
36
46
{
37
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type, An...> type;
47
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, An...> type;
38
48
};
39
49
40
50
// Needed for non-conforming compilers like GCC 4.3
41
51
template <template <class , class > class Cont , typename V, typename A, class U >
42
52
struct container_rebind <Cont<V, A>, U>
43
53
{
44
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type> type;
54
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type> type;
45
55
};
46
56
47
57
template <template <class > class Cont , typename V, class U >
@@ -65,79 +75,79 @@ namespace dtl {
65
75
, class U >
66
76
struct container_rebind <Cont<V, A>, U>
67
77
{
68
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type> type;
78
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type> type;
69
79
};
70
80
71
81
template <template <class , class , class > class Cont // 1arg
72
82
, typename V, typename A, class P0
73
83
, class U >
74
84
struct container_rebind <Cont<V, A, P0>, U>
75
85
{
76
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type, P0> type;
86
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0> type;
77
87
};
78
88
79
89
template <template <class , class , class , class > class Cont // 2arg
80
90
, typename V, typename A, class P0 , class P1
81
91
, class U >
82
92
struct container_rebind <Cont<V, A, P0, P1>, U>
83
93
{
84
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type, P0, P1> type;
94
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1> type;
85
95
};
86
96
87
97
template <template <class , class , class , class , class > class Cont // 3arg
88
98
, typename V, typename A, class P0 , class P1 , class P2
89
99
, class U >
90
100
struct container_rebind <Cont<V, A, P0, P1, P2>, U>
91
101
{
92
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type, P0, P1, P2> type;
102
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1, P2> type;
93
103
};
94
104
95
105
template <template <class , class , class , class , class , class > class Cont // 4arg
96
106
, typename V, typename A, class P0 , class P1 , class P2 , class P3
97
107
, class U >
98
108
struct container_rebind <Cont<V, A, P0, P1, P2, P3>, U>
99
109
{
100
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type, P0, P1, P2, P3> type;
110
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1, P2, P3> type;
101
111
};
102
112
103
113
template <template <class , class , class , class , class , class , class > class Cont // 5arg
104
114
, typename V, typename A, class P0 , class P1 , class P2 , class P3 , class P4
105
115
, class U >
106
116
struct container_rebind <Cont<V, A, P0, P1, P2, P3, P4>, U>
107
117
{
108
- typedef Cont<U, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type, P0, P1, P2, P3, P4> type;
118
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1, P2, P3, P4> type;
109
119
};
110
120
111
121
template <template <class , class , class , class , class , class , class , class > class Cont // 6arg
112
122
, typename V, typename A, class P0 , class P1 , class P2 , class P3 , class P4 , class P5
113
123
, class U >
114
124
struct container_rebind <Cont<V, A, P0, P1, P2, P3, P4, P5>, U>
115
125
{
116
- 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;
126
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1, P2, P3, P4, P5> type;
117
127
};
118
128
119
129
template <template <class , class , class , class , class , class , class , class , class > class Cont // 7arg
120
130
, typename V, typename A, class P0 , class P1 , class P2 , class P3 , class P4 , class P5 , class P6
121
131
, class U >
122
132
struct container_rebind <Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U>
123
133
{
124
- 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;
134
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1, P2, P3, P4, P5, P6> type;
125
135
};
126
136
127
137
template <template <class , class , class , class , class , class , class , class , class , class > class Cont // 8arg
128
138
, typename V, typename A, class P0 , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7
129
139
, class U >
130
140
struct container_rebind <Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
131
141
{
132
- 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;
142
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
133
143
};
134
144
135
145
template <template <class , class , class , class , class , class , class , class , class , class , class > class Cont // 9arg
136
146
, typename V, typename A, class P0 , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8
137
147
, class U >
138
148
struct container_rebind <Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
139
149
{
140
- 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;
150
+ typedef Cont<U, typename void_or_portable_rebind_alloc< V, A, U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
141
151
};
142
152
143
153
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@@ -147,7 +157,7 @@ namespace dtl {
147
157
template <typename V, std::size_t N, typename A, typename O, class U >
148
158
struct container_rebind <small_vector<V, N, A, O>, U>
149
159
{
150
- typedef small_vector<U, N, typename allocator_traits< typename real_allocator< V, A>::type>:: template portable_rebind_alloc< U>::type, O> type;
160
+ typedef small_vector<U, N, typename void_or_portable_rebind_alloc< V, A, U>::type, O> type;
151
161
};
152
162
153
163
template <typename V, std::size_t N, typename O, class U >
0 commit comments