Fix error with initializer_list test code, list has no "insert_after"

This commit is contained in:
Ion Gaztañaga
2015-02-28 00:17:05 +01:00
parent 1025ad2bbc
commit 6332a9f0bb
2 changed files with 52 additions and 3 deletions

View File

@@ -410,6 +410,56 @@ int list_test (bool copied_allocators_equal = true)
return 0;
}
template<class List>
bool test_list_methods_with_initializer_list_as_argument_for()
{
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
const std::initializer_list<int> il = {5, 10, 15};
const List expected_list(il.begin(), il.end());
{
List sl = il;
if(sl != expected_list)
return false;
}
{
List sl = {1, 2};
sl = il;
if(sl != expected_list)
return false;
}
{
List sl({ 1, 2 }, typename List::allocator_type());
sl = il;
if (sl != expected_list)
return false;
}
{
List sl = {4, 5};
sl.assign(il);
if(sl != expected_list)
return false;
}
{
List sl = {15};
sl.insert(sl.cbegin(), {5, 10});
if(sl != expected_list)
return false;
}
{
List sl = {5};
sl.insert_after(sl.cbegin(), {10, 15});
if(sl != expected_list)
return false;
}
return true;
#endif
return true;
}
} //namespace test{
} //namespace container {
} //namespace boost{

View File

@@ -199,9 +199,8 @@ int main()
////////////////////////////////////
// Initializer lists testing
////////////////////////////////////
if(!boost::container::test::test_vector_methods_with_initializer_list_as_argument_for<
boost::container::stable_vector<int>
>())
if(!boost::container::test::test_vector_methods_with_initializer_list_as_argument_for
< boost::container::stable_vector<int> >())
{
std::cerr << "test_methods_with_initializer_list_as_argument failed" << std::endl;
return 1;