mirror of
https://github.com/boostorg/container.git
synced 2026-01-19 04:02:17 +00:00
Implement erase/erase_if for list and slist
This commit is contained in:
@@ -83,6 +83,32 @@ bool list_copyable_only(V1 &boostlist, V2 &stdlist, boost::container::dtl::true_
|
||||
boostlist.assign(v1.begin(), v1.end());
|
||||
stdlist.assign(v2.begin(), v2.end());
|
||||
if(!test::CheckEqualContainers(boostlist, stdlist)) return 1;
|
||||
|
||||
//test erase/erase_if
|
||||
IntType aux_vect[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
aux_vect[i] = i;
|
||||
}
|
||||
int aux_vect2[50];
|
||||
for(int i = 0; i < 50; ++i){
|
||||
aux_vect2[i] = i;
|
||||
}
|
||||
|
||||
boostlist.clear();
|
||||
stdlist.clear();
|
||||
boostlist.insert(boostlist.end()
|
||||
,boost::make_move_iterator(&aux_vect[0])
|
||||
,boost::make_move_iterator(aux_vect + 50));
|
||||
stdlist.insert(stdlist.end(), aux_vect2, aux_vect2 + 50);
|
||||
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
|
||||
|
||||
if (1 != erase(boostlist, 25))
|
||||
return 1;
|
||||
stdlist.erase(boost::container::find(stdlist.begin(), stdlist.end(), 25));
|
||||
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
|
||||
|
||||
if (0 != erase(boostlist, 25))
|
||||
return 1;
|
||||
}
|
||||
{ //List(const List &, alloc)
|
||||
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostlist, typename V1::allocator_type());
|
||||
|
||||
Reference in New Issue
Block a user