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:
@@ -115,6 +115,35 @@ int test_cont_variants()
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool test_support_for_initializer_list()
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
const std::initializer_list<int> il = {1, 10};
|
||||
const list<int> expectedList(il.begin(), il.end());
|
||||
|
||||
const list<int> testConstructor = il;
|
||||
if(testConstructor != expectedList)
|
||||
return false;
|
||||
|
||||
list<int> testAssignOperator = {10, 11};
|
||||
testAssignOperator = il;
|
||||
if(testAssignOperator != expectedList)
|
||||
return false;
|
||||
|
||||
list<int> testAssignMethod = {99};
|
||||
testAssignMethod = il;
|
||||
if(testAssignMethod != expectedList)
|
||||
return false;
|
||||
|
||||
list<int> testInsertMethod;
|
||||
testInsertMethod.insert(testInsertMethod.cbegin(), il);
|
||||
if(testInsertMethod != testInsertMethod)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
@@ -166,6 +195,9 @@ int main ()
|
||||
if(!boost::container::test::test_propagate_allocator<list>())
|
||||
return 1;
|
||||
|
||||
if(!test_support_for_initializer_list())
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user