Skip to content

Commit 72a6b1e

Browse files
committed
Fixes #288 ("Compile error when using flat_map::extract_sequence with small_vector")
1 parent daa81ed commit 72a6b1e

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

include/boost/container/detail/container_or_allocator_rebind.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ struct container_or_allocator_rebind_impl<AllocatorOrContainer, ToType, false>
3838

3939
template<class ToType>
4040
struct container_or_allocator_rebind_impl<void, ToType, false>
41-
: real_allocator<ToType, void>
42-
{};
41+
{ typedef void type; };
4342

4443
template<class AllocatorOrContainer, class ToType>
4544
struct container_or_allocator_rebind

include/boost/container/detail/container_rebind.hpp

+23-13
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ namespace boost {
2626
namespace container {
2727
namespace dtl {
2828

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+
2939
template <class Cont, class U>
3040
struct container_rebind;
3141

@@ -34,14 +44,14 @@ namespace dtl {
3444
template <template <class, class, class...> class Cont, typename V, typename A, class... An, class U>
3545
struct container_rebind<Cont<V, A, An...>, U>
3646
{
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;
3848
};
3949

4050
//Needed for non-conforming compilers like GCC 4.3
4151
template <template <class, class> class Cont, typename V, typename A, class U>
4252
struct container_rebind<Cont<V, A>, U>
4353
{
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;
4555
};
4656

4757
template <template <class> class Cont, typename V, class U>
@@ -65,79 +75,79 @@ namespace dtl {
6575
, class U>
6676
struct container_rebind<Cont<V, A>, U>
6777
{
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;
6979
};
7080

7181
template <template <class, class, class> class Cont //1arg
7282
, typename V, typename A, class P0
7383
, class U>
7484
struct container_rebind<Cont<V, A, P0>, U>
7585
{
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;
7787
};
7888

7989
template <template <class, class, class, class> class Cont //2arg
8090
, typename V, typename A, class P0, class P1
8191
, class U>
8292
struct container_rebind<Cont<V, A, P0, P1>, U>
8393
{
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;
8595
};
8696

8797
template <template <class, class, class, class, class> class Cont //3arg
8898
, typename V, typename A, class P0, class P1, class P2
8999
, class U>
90100
struct container_rebind<Cont<V, A, P0, P1, P2>, U>
91101
{
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;
93103
};
94104

95105
template <template <class, class, class, class, class, class> class Cont //4arg
96106
, typename V, typename A, class P0, class P1, class P2, class P3
97107
, class U>
98108
struct container_rebind<Cont<V, A, P0, P1, P2, P3>, U>
99109
{
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;
101111
};
102112

103113
template <template <class, class, class, class, class, class, class> class Cont //5arg
104114
, typename V, typename A, class P0, class P1, class P2, class P3, class P4
105115
, class U>
106116
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4>, U>
107117
{
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;
109119
};
110120

111121
template <template <class, class, class, class, class, class, class, class> class Cont //6arg
112122
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5
113123
, class U>
114124
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5>, U>
115125
{
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;
117127
};
118128

119129
template <template <class, class, class, class, class, class, class, class, class> class Cont //7arg
120130
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
121131
, class U>
122132
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U>
123133
{
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;
125135
};
126136

127137
template <template <class, class, class, class, class, class, class, class, class, class> class Cont //8arg
128138
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
129139
, class U>
130140
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
131141
{
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;
133143
};
134144

135145
template <template <class, class, class, class, class, class, class, class, class, class, class> class Cont //9arg
136146
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
137147
, class U>
138148
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
139149
{
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;
141151
};
142152

143153
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@@ -147,7 +157,7 @@ namespace dtl {
147157
template <typename V, std::size_t N, typename A, typename O, class U>
148158
struct container_rebind<small_vector<V, N, A, O>, U>
149159
{
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;
151161
};
152162

153163
template <typename V, std::size_t N, typename O, class U>

0 commit comments

Comments
 (0)