Add missing initializer list overload taking an additional allocator.

This commit is contained in:
Ion Gaztañaga
2015-02-28 23:46:08 +01:00
parent 8db0f4ad64
commit d39b1c143c
7 changed files with 136 additions and 42 deletions
+4 -32
View File
@@ -663,39 +663,7 @@ int map_test()
}
return 0;
}
/*
template<typename MapType>
bool test_support_for_initialization_list_for()
{
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
const std::initializer_list<std::pair<const int, int>> il
= {std::make_pair(1, 2), std::make_pair(3, 4)};
const MapType expected(il.begin(), il.end());
{
const MapType sil = il;
if (sil != expected)
return false;
const MapType sil_ordered(ordered_unique_range, il);
if(sil_ordered != expected)
return false;
MapType sil_assign = {std::make_pair(99, 100)};
sil_assign = il;
if(sil_assign != expected)
return false;
}
{
MapType sil;
sil.insert(il);
if(sil != expected)
return false;
}
return true;
#endif
return true;
}
*/
template<typename MapType>
bool test_map_support_for_initialization_list_for()
{
@@ -713,6 +681,10 @@ bool test_map_support_for_initialization_list_for()
if (sila != expected)
return false;
MapType silca(il, typename MapType::key_compare(), typename MapType::allocator_type());
if (silca != expected)
return false;
const MapType sil_ordered(ordered_unique_range, il);
if (sil_ordered != expected)
return false;
+29 -1
View File
@@ -33,7 +33,9 @@ class alloc_propagate_wrapper
typedef typename alloc_propagate_base
<Selector>::template apply<T, Allocator>::type Base;
typedef typename Base::allocator_type allocator_type;
typedef typename Base::allocator_type allocator_type;
typedef typename Base::value_type value_type;
typedef typename Base::size_type size_type;
alloc_propagate_wrapper()
: Base()
@@ -42,6 +44,32 @@ class alloc_propagate_wrapper
explicit alloc_propagate_wrapper(const allocator_type &a)
: Base(a)
{}
/*
//sequence containers only
explicit alloc_propagate_wrapper(size_type n, const value_type &v, const allocator_type &a)
: Base(n, v, a)
{}
alloc_propagate_wrapper(size_type n, const allocator_type &a)
: Base(n, a)
{}*/
template<class Iterator>
alloc_propagate_wrapper(Iterator b, Iterator e, const allocator_type &a)
: Base(b, e, a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
alloc_propagate_wrapper(std::initializer_list<value_type> il, const allocator_type& a)
: Base(il, a)
{}
/*
//associative containers only
alloc_propagate_wrapper(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
: Base(il, comp, a)
{}*/
#endif
alloc_propagate_wrapper(const alloc_propagate_wrapper &x)
: Base(x)
+4
View File
@@ -722,6 +722,10 @@ bool test_set_methods_with_initializer_list_as_argument_for()
if (sila != expected)
return false;
SetType silca(il, typename SetType::key_compare(), typename SetType::allocator_type());
if (silca != expected)
return false;
SetType sil_ordered(ordered_unique_range, ilu);
if (sil_ordered != expectedu)
return false;