forked from boostorg/intrusive
1 parent
637b83f5cf
commit
4e4659cc17
5 files changed
+51
-11
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ rule test_all
|
||||
|
||||
for local fileb in [ glob *.cpp ]
|
||||
{
|
||||
all_rules += [ run $(fileb) /boost/thread//boost_thread
|
||||
all_rules += [ run $(fileb)
|
||||
: # additional args
|
||||
: # test-files
|
||||
: # requirements
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
//[doc_erasing_and_disposing
|
||||
#include <boost/intrusive/list.hpp>
|
||||
|
||||
@@ -50,18 +51,45 @@ int main()
|
||||
//Fill all the nodes and insert them in the list
|
||||
my_class_list list;
|
||||
|
||||
//<-
|
||||
#if 1
|
||||
BOOST_TRY{
|
||||
#else
|
||||
//->
|
||||
try{
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
//Insert new objects in the container
|
||||
for(int i = 0; i < MaxElem; ++i) list.push_back(*new my_class(i));
|
||||
|
||||
//Now use remove_and_dispose_if to erase and delete the objects
|
||||
list.remove_and_dispose_if(is_even(), delete_disposer());
|
||||
}
|
||||
//<-
|
||||
#if 1
|
||||
BOOST_CATCH(...){
|
||||
#else
|
||||
//->
|
||||
catch(...){
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
//If something throws, make sure that all the memory is freed
|
||||
list.clear_and_dispose(delete_disposer());
|
||||
//<-
|
||||
#if 1
|
||||
BOOST_RETHROW
|
||||
#else
|
||||
//->
|
||||
throw;
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
}
|
||||
//<-
|
||||
BOOST_CATCH_END
|
||||
//->
|
||||
|
||||
//Dispose remaining elements
|
||||
list.erase_and_dispose(list.begin(), list.end(), delete_disposer());
|
||||
|
||||
@@ -10,6 +10,18 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
//Interprocess does not support BOOST_NO_EXCEPTIONS so nothing to test here
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else //!BOOST_NO_EXCEPTIONS
|
||||
|
||||
//This is needed to allow concurrent test execution in
|
||||
//several platforms. The shared memory must be unique
|
||||
//for each process...
|
||||
@@ -100,3 +112,6 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#endif //BOOST_NO_EXCEPTIONS
|
||||
|
||||
Reference in new issue
Block a user