Reimplemented remove family for lists using new stable_partition algorithm. This allows less code duplication between lists with different options (constant_time_size, cache_list, safe/non-safe hooks, etc.).

This commit is contained in:
Ion Gaztañaga committed 2014-08-14 00:22:19 +02:00
1 parent 1afec2c716
commit 0a03aa599a
10 files changed
+257 -41

No files matched your search

+21 -4
View File
@@ -21,7 +21,6 @@
#include <boost/detail/lightweight_test.hpp>
#include "test_macros.hpp"
#include "test_container.hpp"
#include <boost/tti/tti.hpp>
#include <typeinfo>
using namespace boost::intrusive;
@@ -38,8 +37,7 @@ struct hooks
typedef list_member_hook< link_mode<auto_unlink>
, void_pointer<VoidPointer> > auto_member_hook_type;
typedef nonhook_node_member< list_node_traits< VoidPointer >,
circular_list_algorithms
> nonhook_node_member_type;
circular_list_algorithms > nonhook_node_member_type;
};
@@ -145,7 +143,26 @@ void test_list< List_Type, Value_Container >
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
}
{
Value_Container values2(values); // NOTE: problematic copy of value container
list_type list(values.begin(), values.end());
list.remove_if(is_odd());
int init_values [] = { 2, 4 };
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
}
{
list_type list(values.begin(), values.end());
list.remove_and_dispose_if(is_even(), test::empty_disposer());
int init_values [] = { 1, 3, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
}
{
list_type list(values.begin(), values.end());
list.remove_and_dispose_if(is_odd(), test::empty_disposer());
int init_values [] = { 2, 4 };
typename list_type::iterator i = list.begin(), e = list.end();
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
}
{
Value_Container values2(values);
list_type list(values.begin(), values.end());
list.insert(list.end(), values2.begin(), values2.end());
list.sort();