no message

[SVN r38076]
This commit is contained in:
Ion Gaztañaga
2007-06-23 13:09:46 +00:00
parent 7be768cf8e
commit 0653ca2678
18 changed files with 412 additions and 370 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
# Boost Intrusive Library Documentation test Jamfile
# Boost Intrusive Library Example Jamfile
# (C) Copyright Ion Gaztañaga 2006-2007.
# Use, modification and distribution are subject to the
@@ -31,4 +31,4 @@ rule test_all
return $(all_rules) ;
}
test-suite intrusive_doc : [ test_all r ] ;
test-suite intrusive_example : [ test_all r ] : <threading>multi ;
+4 -4
View File
@@ -38,8 +38,8 @@ class new_cloner
{ return new my_class(clone_this); }
};
//The destroyer object function
class delete_destroyer
//The disposer object function
class delete_disposer
{
public:
void operator()(my_class *delete_this)
@@ -61,7 +61,7 @@ int main()
//Now clone "list" using "new" and "delete" object functions
my_class_list cloned_list;
cloned_list.clone_from(list, new_cloner(), delete_destroyer());
cloned_list.clone_from(list, new_cloner(), delete_disposer());
//Test that both are equal
if(cloned_list != list){
@@ -72,7 +72,7 @@ int main()
}
//Don't forget to free the memory from the second list
cloned_list.clear_and_destroy(delete_destroyer());
cloned_list.clear_and_dispose(delete_disposer());
return 0;
}
//]
@@ -9,7 +9,7 @@
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
//[doc_erasing_and_destroying
//[doc_erasing_and_disposing
#include <boost/intrusive/list.hpp>
//A class that can be inserted in an intrusive list
@@ -36,8 +36,8 @@ class is_even
{ return 0 == (c.int_ % 2); }
};
//The destroyer object function
class delete_destroyer
//The disposer object function
class delete_disposer
{
public:
void operator()(my_class *delete_this)
@@ -57,17 +57,17 @@ int main()
list.push_back(*new my_class(i));
}
//Now use remove_and_destroy_if to erase and delete the objects
list.remove_and_destroy_if(is_even(), delete_destroyer());
//Now use remove_and_dispose_if to erase and delete the objects
list.remove_and_dispose_if(is_even(), delete_disposer());
}
catch(...){
//If something throws, make sure that all the memory is freed
list.clear_and_destroy(delete_destroyer());
list.clear_and_dispose(delete_disposer());
throw;
}
//Destroy remaining elements
list.erase_and_destroy(list.begin(), list.end(), delete_destroyer());
//Dispose remaining elements
list.erase_and_dispose(list.begin(), list.end(), delete_disposer());
return 0;
}
//]
+1
View File
@@ -79,4 +79,5 @@ int main()
algo::erase(&header, n);
return 0;
}
//]