mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-02 22:14:35 +02:00
@@ -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
|
||||
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <iterator>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
@@ -692,19 +693,20 @@ class array_initializer
|
||||
{
|
||||
char *init_buf = (char*)rawbuf;
|
||||
std::size_t i = 0;
|
||||
try{
|
||||
BOOST_TRY{
|
||||
for(; i != N; ++i){
|
||||
new(init_buf)T(init);
|
||||
init_buf += sizeof(T);
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
BOOST_CATCH(...){
|
||||
while(i--){
|
||||
init_buf -= sizeof(T);
|
||||
((T*)init_buf)->~T();
|
||||
}
|
||||
throw;
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
|
||||
operator T* ()
|
||||
|
@@ -20,19 +20,14 @@ 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
|
||||
<toolset>acc:<linkflags>-lrt
|
||||
<toolset>acc-pa_risc:<linkflags>-lrt
|
||||
<toolset>gcc-mingw:<linkflags>"-lole32 -loleaut32"
|
||||
<host-os>hpux,<toolset>gcc:<linkflags>"-Wl,+as,mpas"
|
||||
<host-os>windows,<toolset>clang:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
|
||||
] ;
|
||||
}
|
||||
|
||||
return $(all_rules) ;
|
||||
}
|
||||
|
||||
test-suite intrusive_test : [ test_all r ] : <threading>multi ;
|
||||
test-suite intrusive_test : [ test_all r ] : ;
|
Reference in New Issue
Block a user