forked from boostorg/container
Add std::initializer_list to the following containers:
* deque * map * multimap * set * multiset * list * slist Tested on clant and g++
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <boost/container/allocator.hpp>
|
||||
#include <boost/container/node_allocator.hpp>
|
||||
#include <boost/container/adaptive_pool.hpp>
|
||||
#include <utility>
|
||||
|
||||
#include "print_container.hpp"
|
||||
#include "movable_int.hpp"
|
||||
@@ -345,6 +346,38 @@ int test_map_variants()
|
||||
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_t{}, 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;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Recursive container instantiation
|
||||
@@ -421,6 +454,12 @@ int main ()
|
||||
if(!boost::container::test::test_propagate_allocator<map_propagate_test_wrapper>())
|
||||
return 1;
|
||||
|
||||
if(!test_support_for_initialization_list_for<map<int, int> >())
|
||||
return 1;
|
||||
|
||||
if(!test_support_for_initialization_list_for<multimap<int, int> >())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Test optimize_size option
|
||||
////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user