Simplify dependencies dropping Boost.Core

This commit is contained in:
Ion Gaztañaga
2023-02-01 23:00:23 +01:00
parent 70f756960e
commit 552688c7fc
35 changed files with 282 additions and 263 deletions

View File

@@ -13,7 +13,6 @@
#endif #endif
#include <boost/container/detail/dlmalloc.hpp> #include <boost/container/detail/dlmalloc.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/container/throw_exception.hpp> #include <boost/container/throw_exception.hpp>
#define BOOST_INTERPROCESS_VECTOR_ALLOC_STATS #define BOOST_INTERPROCESS_VECTOR_ALLOC_STATS
@@ -63,7 +62,7 @@ void allocation_timing_test(std::size_t num_iterations, std::size_t num_elements
dlmalloc_free(first_mem); dlmalloc_free(first_mem);
++numalloc; ++numalloc;
BOOST_TRY{ BOOST_CONTAINER_TRY{
dlmalloc_command_ret_t ret; dlmalloc_command_ret_t ret;
for(size_t e = capacity + 1; e < num_elements; ++e){ for(size_t e = capacity + 1; e < num_elements; ++e){
size_t received_size; size_t received_size;
@@ -101,11 +100,11 @@ void allocation_timing_test(std::size_t num_iterations, std::size_t num_elements
} }
dlmalloc_free(addr); dlmalloc_free(addr);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
dlmalloc_free(addr); dlmalloc_free(addr);
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
assert( dlmalloc_allocated_memory() == 0); assert( dlmalloc_allocated_memory() == 0);

View File

@@ -13,7 +13,6 @@
#endif #endif
#include <boost/container/allocator.hpp> #include <boost/container/allocator.hpp>
#include <boost/core/no_exceptions_support.hpp>
#define BOOST_CONTAINER_VECTOR_ALLOC_STATS #define BOOST_CONTAINER_VECTOR_ALLOC_STATS
@@ -114,7 +113,7 @@ void vector_test_template(std::size_t num_iterations, std::size_t num_elements,
bc::vector<MyInt, IntAllocator> v; bc::vector<MyInt, IntAllocator> v;
v.reset_alloc_stats(); v.reset_alloc_stats();
void *first_mem = 0; void *first_mem = 0;
BOOST_TRY{ BOOST_CONTAINER_TRY{
first_mem = bc::dlmalloc_malloc(sizeof(MyInt)*num_elements*3/2); first_mem = bc::dlmalloc_malloc(sizeof(MyInt)*num_elements*3/2);
v.push_back(MyInt(0)); v.push_back(MyInt(0));
bc::dlmalloc_free(first_mem); bc::dlmalloc_free(first_mem);
@@ -126,11 +125,11 @@ void vector_test_template(std::size_t num_iterations, std::size_t num_elements,
numexpand += v.num_expand_bwd; numexpand += v.num_expand_bwd;
capacity = static_cast<std::size_t>(v.capacity()); capacity = static_cast<std::size_t>(v.capacity());
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
bc::dlmalloc_free(first_mem); bc::dlmalloc_free(first_mem);
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
assert(bc::dlmalloc_allocated_memory() == 0); assert(bc::dlmalloc_allocated_memory() == 0);

View File

@@ -19,7 +19,6 @@
#include <iomanip> #include <iomanip>
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
#include <boost/container/string.hpp> #include <boost/container/string.hpp>
#include <boost/core/no_exceptions_support.hpp>
using boost::move_detail::cpu_timer; using boost::move_detail::cpu_timer;
using boost::move_detail::cpu_times; using boost::move_detail::cpu_times;

View File

@@ -16,7 +16,6 @@
#include "varray.hpp" #include "varray.hpp"
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
#include <boost/container/static_vector.hpp> #include <boost/container/static_vector.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include "../test/movable_int.hpp" #include "../test/movable_int.hpp"
#include <vector> #include <vector>

View File

@@ -18,7 +18,6 @@
#include <limits> #include <limits>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/container/detail/addressof.hpp> #include <boost/container/detail/addressof.hpp>
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@@ -251,18 +250,18 @@ O uninitialized_move_dispatch(I first, I last, O dst,
O o = dst; O o = dst;
BOOST_TRY BOOST_CONTAINER_TRY
{ {
typedef typename boost::container::iterator_traits<O>::value_type value_type; typedef typename boost::container::iterator_traits<O>::value_type value_type;
for (; first != last; ++first, ++o ) for (; first != last; ++first, ++o )
new (boost::container::dtl::addressof(*o)) value_type(boost::move(*first)); new (boost::container::dtl::addressof(*o)) value_type(boost::move(*first));
} }
BOOST_CATCH(...) BOOST_CONTAINER_CATCH(...)
{ {
destroy(dst, o); destroy(dst, o);
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return dst; return dst;
} }
@@ -431,17 +430,17 @@ void uninitialized_fill_dispatch(I first, I last,
typedef typename ::boost::container::iterator_traits<I>::value_type value_type; typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
I it = first; I it = first;
BOOST_TRY BOOST_CONTAINER_TRY
{ {
for ( ; it != last ; ++it ) for ( ; it != last ; ++it )
new (boost::container::dtl::addressof(*it)) value_type(); // may throw new (boost::container::dtl::addressof(*it)) value_type(); // may throw
} }
BOOST_CATCH(...) BOOST_CONTAINER_CATCH(...)
{ {
destroy(first, it); destroy(first, it);
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template <typename I, typename DisableTrivialInit> template <typename I, typename DisableTrivialInit>
@@ -600,7 +599,7 @@ inline std::size_t uninitialized_copy_s(I first, I last, F dest, std::size_t max
std::size_t count = 0; std::size_t count = 0;
F it = dest; F it = dest;
BOOST_TRY BOOST_CONTAINER_TRY
{ {
for ( ; first != last ; ++it, ++first, ++count ) for ( ; first != last ; ++it, ++first, ++count )
{ {
@@ -611,12 +610,12 @@ inline std::size_t uninitialized_copy_s(I first, I last, F dest, std::size_t max
construct(0, it, *first); // may throw construct(0, it, *first); // may throw
} }
} }
BOOST_CATCH(...) BOOST_CONTAINER_CATCH(...)
{ {
destroy(dest, it); destroy(dest, it);
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return count; return count;
} }

View File

@@ -7,13 +7,9 @@
// See http://www.boost.org/libs/container for documentation. // See http://www.boost.org/libs/container for documentation.
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <boost/core/no_exceptions_support.hpp>
//[doc_custom_devector //[doc_custom_devector
#include <boost/container/devector.hpp> #include <boost/container/devector.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
/*<-*/
#include <boost/core/no_exceptions_support.hpp>
/*->*/
//Make sure assertions are active //Make sure assertions are active
#ifdef NDEBUG #ifdef NDEBUG
@@ -39,7 +35,7 @@ int main ()
bool exception_thrown = false; bool exception_thrown = false;
/*<-*/ /*<-*/
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
BOOST_TRY{ size_optimized_devector_t v(256); } BOOST_CATCH(...){ exception_thrown = true; } BOOST_CATCH_END BOOST_CONTAINER_TRY{ size_optimized_devector_t v(256); } BOOST_CONTAINER_CATCH(...){ exception_thrown = true; } BOOST_CONTAINER_CATCH_END
#else #else
exception_thrown = true; exception_thrown = true;
#endif //BOOST_NO_EXCEPTIONS #endif //BOOST_NO_EXCEPTIONS

View File

@@ -7,11 +7,9 @@
// See http://www.boost.org/libs/container for documentation. // See http://www.boost.org/libs/container for documentation.
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <boost/core/no_exceptions_support.hpp>
//[doc_custom_vector //[doc_custom_vector
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/core/no_exceptions_support.hpp>
//Make sure assertions are active //Make sure assertions are active
#ifdef NDEBUG #ifdef NDEBUG
@@ -36,7 +34,7 @@ int main ()
bool exception_thrown = false; bool exception_thrown = false;
/*<-*/ /*<-*/
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
BOOST_TRY{ size_optimized_vector_t v(256); } BOOST_CATCH(...){ exception_thrown = true; } BOOST_CATCH_END BOOST_CONTAINER_TRY{ size_optimized_vector_t v(256); } BOOST_CONTAINER_CATCH(...){ exception_thrown = true; } BOOST_CONTAINER_CATCH_END
#else #else
exception_thrown = true; exception_thrown = true;
#endif //BOOST_NO_EXCEPTIONS #endif //BOOST_NO_EXCEPTIONS

View File

@@ -50,7 +50,6 @@
#include <boost/move/detail/move_helpers.hpp> #include <boost/move/detail/move_helpers.hpp>
// other // other
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/no_exceptions_support.hpp>
// std // std
#include <cstddef> #include <cstddef>
@@ -434,16 +433,16 @@ class deque_base
ptr_alloc_ptr nstart = this->members_.m_map + difference_type(this->members_.m_map_size - num_nodes) / 2; ptr_alloc_ptr nstart = this->members_.m_map + difference_type(this->members_.m_map_size - num_nodes) / 2;
ptr_alloc_ptr nfinish = nstart + difference_type(num_nodes); ptr_alloc_ptr nfinish = nstart + difference_type(num_nodes);
BOOST_TRY { BOOST_CONTAINER_TRY {
this->priv_create_nodes(nstart, nfinish); this->priv_create_nodes(nstart, nfinish);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size); this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size);
this->members_.m_map = 0; this->members_.m_map = 0;
this->members_.m_map_size = 0; this->members_.m_map_size = 0;
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
this->members_.m_start.priv_set_node(nstart, get_block_size()); this->members_.m_start.priv_set_node(nstart, get_block_size());
this->members_.m_finish.priv_set_node(nfinish - 1, get_block_size()); this->members_.m_finish.priv_set_node(nfinish - 1, get_block_size());
@@ -455,15 +454,15 @@ class deque_base
void priv_create_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish) void priv_create_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish)
{ {
ptr_alloc_ptr cur = nstart; ptr_alloc_ptr cur = nstart;
BOOST_TRY { BOOST_CONTAINER_TRY {
for (; cur < nfinish; ++cur) for (; cur < nfinish; ++cur)
*cur = this->priv_allocate_node(); *cur = this->priv_allocate_node();
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->priv_destroy_nodes(nstart, cur); this->priv_destroy_nodes(nstart, cur);
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
void priv_destroy_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish) BOOST_NOEXCEPT_OR_NOTHROW void priv_destroy_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish) BOOST_NOEXCEPT_OR_NOTHROW
@@ -2123,15 +2122,15 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
const size_type raw_gap = n - elemsafter; const size_type raw_gap = n - elemsafter;
::boost::container::uninitialized_move_alloc ::boost::container::uninitialized_move_alloc
(this->alloc(), pos, old_finish, old_finish + difference_type(raw_gap)); (this->alloc(), pos, old_finish, old_finish + difference_type(raw_gap));
BOOST_TRY{ BOOST_CONTAINER_TRY{
proxy.copy_n_and_update(this->alloc(), pos, elemsafter); proxy.copy_n_and_update(this->alloc(), pos, elemsafter);
proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, raw_gap); proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, raw_gap);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->priv_destroy_range(old_finish, old_finish + difference_type(elemsafter)); this->priv_destroy_range(old_finish, old_finish + difference_type(elemsafter));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
this->members_.m_finish = new_finish; this->members_.m_finish = new_finish;
} }
} }
@@ -2176,7 +2175,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
void priv_fill_initialize(const value_type& value) void priv_fill_initialize(const value_type& value)
{ {
index_pointer cur = this->members_.m_start.m_node; index_pointer cur = this->members_.m_start.m_node;
BOOST_TRY { BOOST_CONTAINER_TRY {
for ( ; cur < this->members_.m_finish.m_node; ++cur){ for ( ; cur < this->members_.m_finish.m_node; ++cur){
boost::container::uninitialized_fill_alloc boost::container::uninitialized_fill_alloc
(this->alloc(), *cur, *cur + get_block_ssize(), value); (this->alloc(), *cur, *cur + get_block_ssize(), value);
@@ -2184,26 +2183,26 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
boost::container::uninitialized_fill_alloc boost::container::uninitialized_fill_alloc
(this->alloc(), this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value); (this->alloc(), this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->priv_destroy_range(this->members_.m_start, iterator(*cur, cur, get_block_size())); this->priv_destroy_range(this->members_.m_start, iterator(*cur, cur, get_block_size()));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template <class InIt> template <class InIt>
void priv_range_initialize(InIt first, InIt last, typename iterator_enable_if_tag<InIt, std::input_iterator_tag>::type* =0) void priv_range_initialize(InIt first, InIt last, typename iterator_enable_if_tag<InIt, std::input_iterator_tag>::type* =0)
{ {
this->priv_initialize_map(0); this->priv_initialize_map(0);
BOOST_TRY { BOOST_CONTAINER_TRY {
for ( ; first != last; ++first) for ( ; first != last; ++first)
this->emplace_back(*first); this->emplace_back(*first);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->clear(); this->clear();
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template <class FwdIt> template <class FwdIt>
@@ -2214,7 +2213,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
this->priv_initialize_map(n); this->priv_initialize_map(n);
index_pointer cur_node = this->members_.m_start.m_node; index_pointer cur_node = this->members_.m_start.m_node;
BOOST_TRY { BOOST_CONTAINER_TRY {
for (; cur_node < this->members_.m_finish.m_node; ++cur_node) { for (; cur_node < this->members_.m_finish.m_node; ++cur_node) {
FwdIt mid = first; FwdIt mid = first;
boost::container::iterator_uadvance(mid, get_block_size()); boost::container::iterator_uadvance(mid, get_block_size());
@@ -2223,11 +2222,11 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
} }
::boost::container::uninitialized_copy_alloc(this->alloc(), first, last, this->members_.m_finish.m_first); ::boost::container::uninitialized_copy_alloc(this->alloc(), first, last, this->members_.m_finish.m_first);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node, get_block_size())); this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node, get_block_size()));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
// Called only if this->members_.m_finish.m_cur == this->members_.m_finish.m_first. // Called only if this->members_.m_finish.m_cur == this->members_.m_finish.m_first.
@@ -2268,16 +2267,16 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
this->priv_reallocate_map(new_nodes, true); this->priv_reallocate_map(new_nodes, true);
} }
size_type i = 1; size_type i = 1;
BOOST_TRY { BOOST_CONTAINER_TRY {
for (; i <= new_nodes; ++i) for (; i <= new_nodes; ++i)
*(this->members_.m_start.m_node - difference_type(i)) = this->priv_allocate_node(); *(this->members_.m_start.m_node - difference_type(i)) = this->priv_allocate_node();
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
for (size_type j = 1; j < i; ++j) for (size_type j = 1; j < i; ++j)
this->priv_deallocate_node(*(this->members_.m_start.m_node - difference_type(j))); this->priv_deallocate_node(*(this->members_.m_start.m_node - difference_type(j)));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
return this->members_.m_start - difference_type(n); return this->members_.m_start - difference_type(n);
} }
@@ -2293,16 +2292,16 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
this->priv_reallocate_map(new_nodes, false); this->priv_reallocate_map(new_nodes, false);
} }
size_type i = 1; size_type i = 1;
BOOST_TRY { BOOST_CONTAINER_TRY {
for (; i <= new_nodes; ++i) for (; i <= new_nodes; ++i)
*(this->members_.m_finish.m_node + difference_type(i)) = this->priv_allocate_node(); *(this->members_.m_finish.m_node + difference_type(i)) = this->priv_allocate_node();
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
for (size_type j = 1; j < i; ++j) for (size_type j = 1; j < i; ++j)
this->priv_deallocate_node(*(this->members_.m_finish.m_node + difference_type(j))); this->priv_deallocate_node(*(this->members_.m_finish.m_node + difference_type(j)));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
return this->members_.m_finish + difference_type(n); return this->members_.m_finish + difference_type(n);
} }

View File

@@ -42,7 +42,6 @@
#include <boost/intrusive/slist.hpp> #include <boost/intrusive/slist.hpp>
// other // other
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <cstddef> #include <cstddef>
namespace boost { namespace boost {
@@ -760,7 +759,7 @@ class private_adaptive_node_pool_impl_common
, const size_type real_num_node, const size_type num_subblocks) , const size_type real_num_node, const size_type num_subblocks)
{ {
size_type i = 0; size_type i = 0;
BOOST_TRY{ BOOST_CONTAINER_TRY{
this->priv_invariants(real_num_node, num_subblocks, real_block_alignment); this->priv_invariants(real_num_node, num_subblocks, real_block_alignment);
while(i != n){ while(i != n){
//If there are no free nodes we allocate all needed blocks //If there are no free nodes we allocate all needed blocks
@@ -800,12 +799,12 @@ class private_adaptive_node_pool_impl_common
i += num_elems; i += num_elems;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->priv_deallocate_nodes(chain, max_free_blocks, real_num_node, num_subblocks, real_block_alignment); this->priv_deallocate_nodes(chain, max_free_blocks, real_num_node, num_subblocks, real_block_alignment);
this->priv_invariants(real_num_node, num_subblocks, real_block_alignment); this->priv_invariants(real_num_node, num_subblocks, real_block_alignment);
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
this->priv_invariants(real_num_node, num_subblocks, real_block_alignment); this->priv_invariants(real_num_node, num_subblocks, real_block_alignment);
} }

View File

@@ -41,7 +41,6 @@
#include <boost/move/detail/force_ptr.hpp> #include <boost/move/detail/force_ptr.hpp>
// other // other
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/no_exceptions_support.hpp>
namespace boost { namespace container { namespace dtl { namespace boost { namespace container { namespace dtl {
@@ -315,14 +314,14 @@ struct insert_emplace_proxy
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v; typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v), ::boost::forward<Args>(get<IdxPack>(this->args_))...); alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v), ::boost::forward<Args>(get<IdxPack>(this->args_))...);
value_type *vp = move_detail::force_ptr<value_type *>(&v); value_type *vp = move_detail::force_ptr<value_type *>(&v);
BOOST_TRY{ BOOST_CONTAINER_TRY{
*p = ::boost::move(*vp); *p = ::boost::move(*vp);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
alloc_traits::destroy(a, vp); alloc_traits::destroy(a, vp);
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
alloc_traits::destroy(a, vp); alloc_traits::destroy(a, vp);
} }
}; };
@@ -438,14 +437,14 @@ struct insert_emplace_proxy_arg##N\
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\ typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
value_type *vp = move_detail::force_ptr<value_type *>(&v);\ value_type *vp = move_detail::force_ptr<value_type *>(&v);\
BOOST_TRY{\ BOOST_CONTAINER_TRY{\
*p = ::boost::move(*vp);\ *p = ::boost::move(*vp);\
}\ }\
BOOST_CATCH(...){\ BOOST_CONTAINER_CATCH(...){\
alloc_traits::destroy(a, vp);\ alloc_traits::destroy(a, vp);\
BOOST_RETHROW\ BOOST_CONTAINER_RETHROW\
}\ }\
BOOST_CATCH_END\ BOOST_CONTAINER_CATCH_END\
alloc_traits::destroy(a, vp);\ alloc_traits::destroy(a, vp);\
}\ }\
};\ };\

View File

@@ -29,7 +29,6 @@
#include <boost/container/detail/allocation_type.hpp> //allocation_type #include <boost/container/detail/allocation_type.hpp> //allocation_type
#include <boost/container/detail/mpl.hpp> //integral_constant #include <boost/container/detail/mpl.hpp> //integral_constant
#include <boost/intrusive/pointer_traits.hpp> //pointer_traits #include <boost/intrusive/pointer_traits.hpp> //pointer_traits
#include <boost/core/no_exceptions_support.hpp> //BOOST_TRY
namespace boost { namespace boost {
namespace container { namespace container {
@@ -139,15 +138,15 @@ struct allocator_version_traits<Allocator, 1>
throw_logic_error("version 1 allocator without allocate_new flag"); throw_logic_error("version 1 allocator without allocate_new flag");
} }
else{ else{
BOOST_TRY{ BOOST_CONTAINER_TRY{
ret = a.allocate(prefer_in_recvd_out_size); ret = a.allocate(prefer_in_recvd_out_size);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
if(!(command & nothrow_allocation)){ if(!(command & nothrow_allocation)){
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
reuse = pointer(); reuse = pointer();
} }
return ret; return ret;

View File

@@ -34,7 +34,6 @@
#include <boost/move/utility_core.hpp> #include <boost/move/utility_core.hpp>
#include <boost/move/traits.hpp> #include <boost/move/traits.hpp>
// other // other
#include <boost/core/no_exceptions_support.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
// std // std
#include <cstring> //for memmove/memcpy #include <cstring> //for memmove/memcpy
@@ -351,19 +350,19 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_move_alloc(Allocator &a, I f, I l, F r) uninitialized_move_alloc(Allocator &a, I f, I l, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (f != l) { while (f != l) {
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return r; return r;
} }
@@ -396,20 +395,20 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_move_alloc_n(Allocator &a, I f, std::size_t n, F r) uninitialized_move_alloc_n(Allocator &a, I f, std::size_t n, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (n) { while (n) {
--n; --n;
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return r; return r;
} }
@@ -442,20 +441,20 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
uninitialized_move_alloc_n_source(Allocator &a, I f, std::size_t n, F r) uninitialized_move_alloc_n_source(Allocator &a, I f, std::size_t n, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (n) { while (n) {
--n; --n;
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return f; return f;
} }
@@ -488,19 +487,19 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_copy_alloc(Allocator &a, I f, I l, F r) uninitialized_copy_alloc(Allocator &a, I f, I l, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (f != l) { while (f != l) {
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f);
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return r; return r;
} }
@@ -533,20 +532,20 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_copy_alloc_n(Allocator &a, I f, std::size_t n, F r) uninitialized_copy_alloc_n(Allocator &a, I f, std::size_t n, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (n) { while (n) {
--n; --n;
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f);
++f; ++r; ++f; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return r; return r;
} }
@@ -579,19 +578,19 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
uninitialized_copy_alloc_n_source(Allocator &a, I f, std::size_t n, F r) uninitialized_copy_alloc_n_source(Allocator &a, I f, std::size_t n, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (n) { while (n) {
boost::container::construct_in_place(a, boost::movelib::iterator_to_raw_pointer(r), f); boost::container::construct_in_place(a, boost::movelib::iterator_to_raw_pointer(r), f);
++f; ++r; --n; ++f; ++r; --n;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return f; return f;
} }
@@ -623,20 +622,20 @@ inline typename dtl::disable_if_memzero_initializable<F, F>::type
uninitialized_value_init_alloc_n(Allocator &a, std::size_t n, F r) uninitialized_value_init_alloc_n(Allocator &a, std::size_t n, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (n) { while (n) {
--n; --n;
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r)); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r));
++r; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return r; return r;
} }
@@ -675,20 +674,20 @@ template
inline F uninitialized_default_init_alloc_n(Allocator &a, std::size_t n, F r) inline F uninitialized_default_init_alloc_n(Allocator &a, std::size_t n, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (n) { while (n) {
--n; --n;
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), default_init); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), default_init);
++r; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return r; return r;
} }
@@ -712,19 +711,19 @@ template
inline void uninitialized_fill_alloc(Allocator &a, F f, F l, const T &t) inline void uninitialized_fill_alloc(Allocator &a, F f, F l, const T &t)
{ {
F back = f; F back = f;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (f != l) { while (f != l) {
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(f), t); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(f), t);
++f; ++f;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != l; ++back){ for (; back != l; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
@@ -748,20 +747,20 @@ template
inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, std::size_t n, F r) inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, std::size_t n, F r)
{ {
F back = r; F back = r;
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (n) { while (n) {
--n; --n;
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), v); allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), v);
++r; ++r;
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
for (; back != r; ++back){ for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back)); allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
} }
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return r; return r;
} }

View File

@@ -33,8 +33,6 @@
#endif #endif
#include <boost/move/utility_core.hpp> #include <boost/move/utility_core.hpp>
#include <boost/core/no_exceptions_support.hpp>
namespace boost { namespace container { namespace boost { namespace container {
namespace dtl { namespace dtl {
@@ -228,14 +226,14 @@ BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if<dtl::is_pair<Pair> BOOST_MO
, Pair* p) , Pair* p)
{ {
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first)); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first));
BOOST_TRY{ BOOST_CONTAINER_TRY{
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second)); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second));
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first)); allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
@@ -249,14 +247,14 @@ BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if<dtl::is_pair<Pair> BOOST_MO
, Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) , Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
{ {
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<U>(x)); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<U>(x));
BOOST_TRY{ BOOST_CONTAINER_TRY{
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<V>(y)); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<V>(y));
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first)); allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template < typename ConstructAlloc template < typename ConstructAlloc
@@ -296,15 +294,15 @@ typename dtl::enable_if< dtl::is_pair<Pair> BOOST_MOVE_I void>::type\
(void)p; (void)q;\ (void)p; (void)q;\
dispatch_uses_allocator\ dispatch_uses_allocator\
(construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\
BOOST_TRY{\ BOOST_CONTAINER_TRY{\
dispatch_uses_allocator\ dispatch_uses_allocator\
(construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\
}\ }\
BOOST_CATCH(...) {\ BOOST_CONTAINER_CATCH(...) {\
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\ allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\
BOOST_RETHROW\ BOOST_CONTAINER_RETHROW\
}\ }\
BOOST_CATCH_END\ BOOST_CONTAINER_CATCH_END\
}\ }\
// //
BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE) BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE)
@@ -320,14 +318,14 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
{ {
(void)t1; (void)t2; (void)t1; (void)t2;
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->first), ::boost::forward<Args1>(get<Indexes1>(t1))...); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->first), ::boost::forward<Args1>(get<Indexes1>(t1))...);
BOOST_TRY{ BOOST_CONTAINER_TRY{
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->second), ::boost::forward<Args2>(get<Indexes2>(t2))...); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->second), ::boost::forward<Args2>(get<Indexes2>(t2))...);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first)); allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template< typename ConstructAlloc, typename ArgAlloc, class Pair template< typename ConstructAlloc, typename ArgAlloc, class Pair
@@ -356,15 +354,15 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
(void)p; (void)q;\ (void)p; (void)q;\
dispatch_uses_allocator\ dispatch_uses_allocator\
(construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\
BOOST_TRY{\ BOOST_CONTAINER_TRY{\
dispatch_uses_allocator\ dispatch_uses_allocator\
(construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\
}\ }\
BOOST_CATCH(...) {\ BOOST_CONTAINER_CATCH(...) {\
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\ allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\
BOOST_RETHROW\ BOOST_CONTAINER_RETHROW\
}\ }\
BOOST_CATCH_END\ BOOST_CONTAINER_CATCH_END\
}\ }\
// //
BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE) BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE)
@@ -391,15 +389,15 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
(void)p; (void)q;\ (void)p; (void)q;\
dispatch_uses_allocator\ dispatch_uses_allocator\
(construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\
BOOST_TRY{\ BOOST_CONTAINER_TRY{\
dispatch_uses_allocator\ dispatch_uses_allocator\
(construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\
}\ }\
BOOST_CATCH(...) {\ BOOST_CONTAINER_CATCH(...) {\
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\ allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\
BOOST_RETHROW\ BOOST_CONTAINER_RETHROW\
}\ }\
BOOST_CATCH_END\ BOOST_CONTAINER_CATCH_END\
}\ }\
// //
BOOST_MOVE_ITER2D_0TOMAX(BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE) BOOST_MOVE_ITER2D_0TOMAX(BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE)
@@ -418,14 +416,14 @@ typename dtl::enable_if< dtl::is_pair<Pair>, void >::type
(ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) (ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args)
{ {
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k)); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k));
BOOST_TRY{ BOOST_CONTAINER_TRY{
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<Args>(args)...); dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<Args>(args)...);
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first)); allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
#else #else
@@ -439,14 +437,14 @@ typename dtl::enable_if< dtl::is_pair<Pair>, void >::type
BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
{\ {\
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k));\ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k));\
BOOST_TRY{\ BOOST_CONTAINER_TRY{\
dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
}\ }\
BOOST_CATCH(...) {\ BOOST_CONTAINER_CATCH(...) {\
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));\ allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));\
BOOST_RETHROW\ BOOST_CONTAINER_RETHROW\
}\ }\
BOOST_CATCH_END\ BOOST_CONTAINER_CATCH_END\
}\ }\
// //
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE) BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE)

View File

@@ -30,6 +30,8 @@
// Extremely Light-Weight wrapper classes for OS thread synchronization // Extremely Light-Weight wrapper classes for OS thread synchronization
#define BOOST_MUTEX_HELPER_NONE 0 #define BOOST_MUTEX_HELPER_NONE 0
#define BOOST_MUTEX_HELPER_WIN32 1 #define BOOST_MUTEX_HELPER_WIN32 1
#define BOOST_MUTEX_HELPER_PTHREAD 2 #define BOOST_MUTEX_HELPER_PTHREAD 2
@@ -50,14 +52,6 @@
defined(__i386__) || defined(__x86_64__))) || \ defined(__i386__) || defined(__x86_64__))) || \
(defined(_MSC_VER) && _MSC_VER>=1310)) (defined(_MSC_VER) && _MSC_VER>=1310))
#define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_SPINLOCKS #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_SPINLOCKS
#endif
#if defined(BOOST_WINDOWS)
#include <boost/winapi/critical_section.hpp>
#include <boost/winapi/thread.hpp>
#ifndef BOOST_MUTEX_HELPER
#define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_WIN32
#endif
#elif defined(BOOST_HAS_UNISTD_H) #elif defined(BOOST_HAS_UNISTD_H)
#include <unistd.h> #include <unistd.h>
#if !defined(BOOST_MUTEX_HELPER) && (defined(_POSIX_THREADS) || defined(BOOST_HAS_PTHREADS)) #if !defined(BOOST_MUTEX_HELPER) && (defined(_POSIX_THREADS) || defined(BOOST_HAS_PTHREADS))
@@ -74,11 +68,9 @@
//... //...
#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_SPINLOCKS #elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_SPINLOCKS
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <boost/detail/interlocked.hpp> #include <intrin.h>
#define interlockedcompareexchange _InterlockedCompareExchange
#define interlockedexchange _InterlockedExchange #define interlockedexchange _InterlockedExchange
#elif defined(WIN32) && defined(__GNUC__) #elif defined(WIN32) && defined(__GNUC__)
#define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b)
#define interlockedexchange __sync_lock_test_and_set #define interlockedexchange __sync_lock_test_and_set
#endif /* Win32 */ #endif /* Win32 */
@@ -123,8 +115,52 @@
/* How to yield for a spin lock */ /* How to yield for a spin lock */
#define SPINS_PER_YIELD 63 #define SPINS_PER_YIELD 63
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
#if !defined( BOOST_USE_WINDOWS_H )
#if defined (WIN32_PLATFORM_PSPC)
#define BOOST_CONTAINERWINAPI_IMPORT BOOST_SYMBOL_IMPORT
#elif defined (_WIN32_WCE)
#define BOOST_CONTAINERWINAPI_IMPORT
#else
#define BOOST_CONTAINERWINAPI_IMPORT BOOST_SYMBOL_IMPORT
#endif
#if defined(WINAPI)
#define BOOST_CONTAINERWINAPI_WINAPI_CC WINAPI
#else
#if defined(_M_IX86) || defined(__i386__)
#define BOOST_CONTAINERWINAPI_DETAIL_STDCALL __stdcall
#else
#define BOOST_CONTAINERWINAPI_DETAIL_STDCALL
#endif
#define BOOST_CONTAINERWINAPI_WINAPI_CC BOOST_CONTAINERWINAPI_DETAIL_STDCALL
#endif
#if !defined(__LP64__)
namespace boost {
namespace container_winapi {
typedef unsigned long DWORD_;
#else
typedef unsigned int DWORD_;
#endif
typedef int BOOL_;
}}
extern "C" {
BOOST_CONTAINERWINAPI_IMPORT boost::container_winapi::DWORD_ BOOST_CONTAINERWINAPI_WINAPI_CC
SleepEx(
boost::container_winapi::DWORD_ dwMilliseconds,
boost::container_winapi::BOOL_ bAlertable);
} // extern "C"
#endif
namespace boost {
namespace container_winapi {
using ::SleepEx;
}
}
#define SLEEP_EX_DURATION 50 /* delay for yield/sleep */ #define SLEEP_EX_DURATION 50 /* delay for yield/sleep */
#define SPIN_LOCK_YIELD boost::winapi::SleepEx(SLEEP_EX_DURATION, 0) #define SPIN_LOCK_YIELD boost::container_winapi::SleepEx(SLEEP_EX_DURATION, 0)
#elif defined (__SVR4) && defined (__sun) /* solaris */ #elif defined (__SVR4) && defined (__sun) /* solaris */
#include <thread.h> #include <thread.h>
#define SPIN_LOCK_YIELD thr_yield(); #define SPIN_LOCK_YIELD thr_yield();

View File

@@ -45,8 +45,6 @@
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/move/detail/fwd_macros.hpp> #include <boost/move/detail/fwd_macros.hpp>
#endif #endif
// other
#include <boost/core/no_exceptions_support.hpp>
namespace boost { namespace boost {
@@ -417,26 +415,26 @@ struct node_alloc_holder
NodePtr create_node_from_key(BOOST_FWD_REF(KeyConvertible) key) NodePtr create_node_from_key(BOOST_FWD_REF(KeyConvertible) key)
{ {
NodePtr p = this->allocate_one(); NodePtr p = this->allocate_one();
BOOST_TRY{ BOOST_CONTAINER_TRY{
::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) Node; ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) Node;
NodeAlloc &na = this->node_alloc(); NodeAlloc &na = this->node_alloc();
node_allocator_traits_type::construct node_allocator_traits_type::construct
(na, dtl::addressof(p->get_real_data().first), boost::forward<KeyConvertible>(key)); (na, dtl::addressof(p->get_real_data().first), boost::forward<KeyConvertible>(key));
BOOST_TRY{ BOOST_CONTAINER_TRY{
node_allocator_traits_type::construct(na, dtl::addressof(p->get_real_data().second)); node_allocator_traits_type::construct(na, dtl::addressof(p->get_real_data().second));
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
node_allocator_traits_type::destroy(na, dtl::addressof(p->get_real_data().first)); node_allocator_traits_type::destroy(na, dtl::addressof(p->get_real_data().first));
BOOST_RETHROW; BOOST_CONTAINER_RETHROW;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
p->destroy_header(); p->destroy_header();
this->node_alloc().deallocate(p, 1); this->node_alloc().deallocate(p, 1);
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return (p); return (p);
} }
@@ -470,7 +468,7 @@ struct node_alloc_holder
chain.clear(); chain.clear();
Node *p = 0; Node *p = 0;
BOOST_TRY{ BOOST_CONTAINER_TRY{
Deallocator node_deallocator(NodePtr(), nalloc); Deallocator node_deallocator(NodePtr(), nalloc);
dtl::scoped_node_destructor<NodeAlloc> sdestructor(nalloc, 0); dtl::scoped_node_destructor<NodeAlloc> sdestructor(nalloc, 0);
while(n){ while(n){
@@ -490,12 +488,12 @@ struct node_alloc_holder
sdestructor.release(); sdestructor.release();
node_deallocator.release(); node_deallocator.release();
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
chain.incorporate_after(chain.last(), &*itbeg, &*itlast, n); chain.incorporate_after(chain.last(), &*itbeg, &*itlast, n);
node_allocator_version_traits_type::deallocate_individual(this->node_alloc(), chain); node_allocator_version_traits_type::deallocate_individual(this->node_alloc(), chain);
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
} }

View File

@@ -33,7 +33,6 @@
#include <boost/intrusive/set.hpp> #include <boost/intrusive/set.hpp>
#include <boost/intrusive/slist.hpp> #include <boost/intrusive/slist.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <cstddef> #include <cstddef>
@@ -310,7 +309,7 @@ class private_node_pool_impl
size_type blocksize = size_type blocksize =
(get_rounded_size)(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value); (get_rounded_size)(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
BOOST_TRY{ BOOST_CONTAINER_TRY{
for(size_type i = 0; i != num_blocks; ++i){ for(size_type i = 0; i != num_blocks; ++i){
//We allocate a new NodeBlock and put it as first //We allocate a new NodeBlock and put it as first
//element in the free Node list //element in the free Node list
@@ -326,11 +325,11 @@ class private_node_pool_impl
} }
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
//to-do: if possible, an efficient way to deallocate allocated blocks //to-do: if possible, an efficient way to deallocate allocated blocks
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
//!Deprecated, use deallocate_free_blocks //!Deprecated, use deallocate_free_blocks

View File

@@ -53,8 +53,6 @@
#endif #endif
#include <boost/move/detail/move_helpers.hpp> #include <boost/move/detail/move_helpers.hpp>
#include <boost/move/detail/force_ptr.hpp> #include <boost/move/detail/force_ptr.hpp>
// other
#include <boost/core/no_exceptions_support.hpp>
@@ -311,20 +309,20 @@ class RecyclingCloner
{ {
if(node_ptr_type p = m_icont.unlink_leftmost_without_rebalance()){ if(node_ptr_type p = m_icont.unlink_leftmost_without_rebalance()){
//First recycle a node (this can't throw) //First recycle a node (this can't throw)
BOOST_TRY{ BOOST_CONTAINER_TRY{
//This can throw //This can throw
this->do_assign(p, other, bool_<DoMove>()); this->do_assign(p, other, bool_<DoMove>());
return p; return p;
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
//If there is an exception destroy the whole source //If there is an exception destroy the whole source
m_holder.destroy_node(p); m_holder.destroy_node(p);
while((p = m_icont.unlink_leftmost_without_rebalance())){ while((p = m_icont.unlink_leftmost_without_rebalance())){
m_holder.destroy_node(p); m_holder.destroy_node(p);
} }
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
else{ else{
return m_holder.create_node(boost::move(other.get_real_data())); return m_holder.create_node(boost::move(other.get_real_data()));

View File

@@ -161,5 +161,30 @@ BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore(T1 const&)
}} //namespace boost::container { }} //namespace boost::container {
#if !(defined BOOST_NO_EXCEPTIONS)
# define BOOST_CONTAINER_TRY { try
# define BOOST_CONTAINER_CATCH(x) catch(x)
# define BOOST_CONTAINER_RETHROW throw;
# define BOOST_CONTAINER_CATCH_END }
#else
# if !defined(BOOST_MSVC) || BOOST_MSVC >= 1900
# define BOOST_CONTAINER_TRY { if (true)
# define BOOST_CONTAINER_CATCH(x) else if (false)
# else
// warning C4127: conditional expression is constant
# define BOOST_CONTAINER_TRY { \
__pragma(warning(push)) \
__pragma(warning(disable: 4127)) \
if (true) \
__pragma(warning(pop))
# define BOOST_CONTAINER_CATCH(x) else \
__pragma(warning(push)) \
__pragma(warning(disable: 4127)) \
if (false) \
__pragma(warning(pop))
# endif
# define BOOST_CONTAINER_RETHROW
# define BOOST_CONTAINER_CATCH_END }
#endif
#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP

View File

@@ -48,8 +48,6 @@
#include <boost/move/algo/detail/merge.hpp> #include <boost/move/algo/detail/merge.hpp>
#include <boost/move/detail/force_ptr.hpp> #include <boost/move/detail/force_ptr.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
//std //std
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> //for std::initializer_list #include <initializer_list> //for std::initializer_list
@@ -348,17 +346,17 @@ class devector
) )
: m_(allocator) : m_(allocator)
{ {
BOOST_TRY{ BOOST_CONTAINER_TRY{
while (first != last) { while (first != last) {
this->emplace_back(*first++); this->emplace_back(*first++);
} }
BOOST_ASSERT(invariants_ok()); BOOST_ASSERT(invariants_ok());
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
this->destroy_elements(m_.buffer + m_.front_idx, m_.buffer + m_.back_idx); this->destroy_elements(m_.buffer + m_.front_idx, m_.buffer + m_.back_idx);
this->deallocate_buffer(); this->deallocate_buffer();
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -43,8 +43,6 @@
// intrusive // intrusive
#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair #include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal #include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
//others
#include <boost/core/no_exceptions_support.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>

View File

@@ -46,7 +46,6 @@
#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal #include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
// other // other
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/core/no_exceptions_support.hpp>
// std // std
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>

View File

@@ -30,7 +30,7 @@
#include <boost/move/utility_core.hpp> #include <boost/move/utility_core.hpp>
#include <boost/move/adl_move_swap.hpp> #include <boost/move/adl_move_swap.hpp>
#include <boost/type_traits/aligned_storage.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
@@ -112,15 +112,16 @@ class node_handle
BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle) BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle)
typedef typename nator_traits::pointer node_pointer; typedef typename nator_traits::pointer node_pointer;
typedef ::boost::aligned_storage typedef typename dtl::aligned_storage
< sizeof(nallocator_type) < sizeof(nallocator_type)
, boost::alignment_of<nallocator_type>::value> nalloc_storage_t; , dtl::alignment_of<nallocator_type>::value
>::type nalloc_storage_t;
node_pointer m_ptr; node_pointer m_ptr;
nalloc_storage_t m_nalloc_storage; nalloc_storage_t m_nalloc_storage;
void move_construct_alloc(nallocator_type &al) void move_construct_alloc(nallocator_type &al)
{ ::new(m_nalloc_storage.address(), boost_container_new_t()) nallocator_type(::boost::move(al)); } { ::new((void*)m_nalloc_storage.data, boost_container_new_t()) nallocator_type(::boost::move(al)); }
void destroy_deallocate_node() void destroy_deallocate_node()
{ {
@@ -132,7 +133,7 @@ class node_handle
void move_construct_end(OtherNodeHandle &nh) void move_construct_end(OtherNodeHandle &nh)
{ {
if(m_ptr){ if(m_ptr){
::new (m_nalloc_storage.address(), boost_container_new_t()) nallocator_type(::boost::move(nh.node_alloc())); ::new ((void*)m_nalloc_storage.data, boost_container_new_t()) nallocator_type(::boost::move(nh.node_alloc()));
node_handle_friend::destroy_alloc(nh); node_handle_friend::destroy_alloc(nh);
node_handle_friend::get_node_pointer(nh) = node_pointer(); node_handle_friend::get_node_pointer(nh) = node_pointer();
} }
@@ -140,7 +141,7 @@ class node_handle
} }
void destroy_alloc() BOOST_NOEXCEPT void destroy_alloc() BOOST_NOEXCEPT
{ static_cast<nallocator_type*>(m_nalloc_storage.address())->~nallocator_type(); } { static_cast<nallocator_type*>((void*)m_nalloc_storage.data)->~nallocator_type(); }
node_pointer &get_node_pointer() BOOST_NOEXCEPT node_pointer &get_node_pointer() BOOST_NOEXCEPT
{ return m_ptr; } { return m_ptr; }
@@ -161,7 +162,7 @@ class node_handle
: m_ptr(p) : m_ptr(p)
{ {
if(m_ptr){ if(m_ptr){
::new (m_nalloc_storage.address(), boost_container_new_t()) nallocator_type(al); ::new ((void*)m_nalloc_storage.data, boost_container_new_t()) nallocator_type(al);
} }
} }
@@ -374,7 +375,7 @@ class node_handle
nallocator_type &node_alloc() BOOST_NOEXCEPT nallocator_type &node_alloc() BOOST_NOEXCEPT
{ {
BOOST_ASSERT(!empty()); BOOST_ASSERT(!empty());
return *static_cast<nallocator_type*>(m_nalloc_storage.address()); return *static_cast<nallocator_type*>((void*)m_nalloc_storage.data);
} }
@@ -384,7 +385,7 @@ class node_handle
const nallocator_type &node_alloc() const BOOST_NOEXCEPT const nallocator_type &node_alloc() const BOOST_NOEXCEPT
{ {
BOOST_ASSERT(!empty()); BOOST_ASSERT(!empty());
return *static_cast<const nallocator_type*>(m_nalloc_storage.address()); return *static_cast<const nallocator_type*>((const void*)m_nalloc_storage.data);
} }
//! <b>Effects</b>: x.swap(y). //! <b>Effects</b>: x.swap(y).

View File

@@ -38,8 +38,6 @@
#endif #endif
#include <boost/move/utility_core.hpp> #include <boost/move/utility_core.hpp>
#include <boost/core/no_exceptions_support.hpp>
namespace boost { namespace container { namespace boost { namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -48,8 +48,6 @@
#endif #endif
#include <boost/move/detail/move_helpers.hpp> #include <boost/move/detail/move_helpers.hpp>
#include <boost/move/detail/force_ptr.hpp> #include <boost/move/detail/force_ptr.hpp>
// other
#include <boost/core/no_exceptions_support.hpp>
// std // std
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>

View File

@@ -60,7 +60,6 @@
#include <boost/move/detail/iterator_to_raw_pointer.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp>
// other // other
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/no_exceptions_support.hpp>
// std // std
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>
@@ -2091,38 +2090,38 @@ class stable_vector
{ {
node_type *praw = ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) node_type *praw = ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t())
node_type(index_traits_type::ptr_to_node_base_ptr(*up_index)); node_type(index_traits_type::ptr_to_node_base_ptr(*up_index));
BOOST_TRY{ BOOST_CONTAINER_TRY{
//This can throw //This can throw
boost::container::construct_in_place boost::container::construct_in_place
( this->priv_node_alloc() ( this->priv_node_alloc()
, praw->get_data_ptr() , praw->get_data_ptr()
, it); , it);
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
praw->destroy_header(); praw->destroy_header();
this->priv_node_alloc().deallocate(p, 1); this->priv_node_alloc().deallocate(p, 1);
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template<class ValueConvertible> template<class ValueConvertible>
void priv_build_node_from_convertible(const node_ptr &p, BOOST_FWD_REF(ValueConvertible) value_convertible) void priv_build_node_from_convertible(const node_ptr &p, BOOST_FWD_REF(ValueConvertible) value_convertible)
{ {
node_type *praw = ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) node_type; node_type *praw = ::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) node_type;
BOOST_TRY{ BOOST_CONTAINER_TRY{
//This can throw //This can throw
boost::container::allocator_traits<node_allocator_type>::construct boost::container::allocator_traits<node_allocator_type>::construct
( this->priv_node_alloc() ( this->priv_node_alloc()
, p->get_data_ptr() , p->get_data_ptr()
, ::boost::forward<ValueConvertible>(value_convertible)); , ::boost::forward<ValueConvertible>(value_convertible));
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
praw->destroy_header(); praw->destroy_header();
this->priv_node_alloc().deallocate(p, 1); this->priv_node_alloc().deallocate(p, 1);
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
void priv_swap_members(stable_vector &x) void priv_swap_members(stable_vector &x)

View File

@@ -50,7 +50,6 @@
#include <boost/move/traits.hpp> #include <boost/move/traits.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <iosfwd> #include <iosfwd>
#include <istream> // #include <istream> //
@@ -2969,7 +2968,7 @@ class basic_string
const size_type long_size = this->priv_long_size(); const size_type long_size = this->priv_long_size();
const size_type long_storage = this->priv_long_storage(); const size_type long_storage = this->priv_long_storage();
//We can make this nothrow as chars are always NoThrowCopyables //We can make this nothrow as chars are always NoThrowCopyables
BOOST_TRY{ BOOST_CONTAINER_TRY{
pointer reuse = 0; pointer reuse = 0;
real_cap = long_size+1; real_cap = long_size+1;
const pointer ret = this->allocation_command(allocate_new, long_size+1, real_cap, reuse); const pointer ret = this->allocation_command(allocate_new, long_size+1, real_cap, reuse);
@@ -2982,10 +2981,10 @@ class basic_string
//And release old buffer //And release old buffer
this->alloc().deallocate(long_addr, long_storage); this->alloc().deallocate(long_addr, long_storage);
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
return; return;
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template<class AllocVersion> template<class AllocVersion>
@@ -3015,20 +3014,20 @@ class basic_string
//Save initial position //Save initial position
FwdIt init = first; FwdIt init = first;
BOOST_TRY{ BOOST_CONTAINER_TRY{
//Construct objects //Construct objects
for (; count--; ++first){ for (; count--; ++first){
this->construct(first, val); this->construct(first, val);
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
//Call destructors //Call destructors
for (; init != first; ++init){ for (; init != first; ++init){
this->destroy(init); this->destroy(init);
} }
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
} }
template<class InpIt, class FwdIt> inline template<class InpIt, class FwdIt> inline
@@ -3038,20 +3037,20 @@ class basic_string
FwdIt dest_init = dest; FwdIt dest_init = dest;
size_type constructed = 0; size_type constructed = 0;
BOOST_TRY{ BOOST_CONTAINER_TRY{
//Try to build objects //Try to build objects
for (; first != last; ++dest, ++first, ++constructed){ for (; first != last; ++dest, ++first, ++constructed){
this->construct(dest, *first); this->construct(dest, *first);
} }
} }
BOOST_CATCH(...){ BOOST_CONTAINER_CATCH(...){
//Call destructors //Call destructors
for (; constructed--; ++dest_init){ for (; constructed--; ++dest_init){
this->destroy(dest_init); this->destroy(dest_init);
} }
BOOST_RETHROW BOOST_CONTAINER_RETHROW
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
return (constructed); return (constructed);
} }

View File

@@ -62,7 +62,6 @@
#include <boost/move/algo/predicate.hpp> #include <boost/move/algo/predicate.hpp>
#include <boost/move/algo/detail/set_difference.hpp> #include <boost/move/algo/detail/set_difference.hpp>
// other // other
#include <boost/core/no_exceptions_support.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>

View File

@@ -11,7 +11,6 @@
#define BOOST_CONTAINER_SOURCE #define BOOST_CONTAINER_SOURCE
#include <boost/container/pmr/memory_resource.hpp> #include <boost/container/pmr/memory_resource.hpp>
#include <boost/container/pmr/global_resource.hpp> #include <boost/container/pmr/global_resource.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/container/throw_exception.hpp> #include <boost/container/throw_exception.hpp>
#include <boost/container/detail/dlmalloc.hpp> //For global lock #include <boost/container/detail/dlmalloc.hpp> //For global lock
#include <boost/container/detail/singleton.hpp> #include <boost/container/detail/singleton.hpp>

View File

@@ -28,7 +28,6 @@
#include "propagate_allocator_test.hpp" #include "propagate_allocator_test.hpp"
#include "vector_test.hpp" #include "vector_test.hpp"
#include "default_init_test.hpp" #include "default_init_test.hpp"
#include <boost/core/no_exceptions_support.hpp>
#include "../../intrusive/test/iterator_test.hpp" #include "../../intrusive/test/iterator_test.hpp"
using namespace boost::container; using namespace boost::container;

View File

@@ -18,7 +18,6 @@
#include <boost/container/list.hpp> #include <boost/container/list.hpp>
#include <boost/container/allocator.hpp> #include <boost/container/allocator.hpp>
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/type_traits/is_default_constructible.hpp> #include <boost/type_traits/is_default_constructible.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp> #include <boost/type_traits/is_nothrow_move_constructible.hpp>
#include "dummy_test_allocator.hpp" #include "dummy_test_allocator.hpp"
@@ -636,13 +635,13 @@ template <class Devector> void test_il_assignment()
test_elem_throw::on_copy_after(3); test_elem_throw::on_copy_after(3);
BOOST_TRY BOOST_CONTAINER_TRY
{ {
a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
BOOST_TEST(false); BOOST_TEST(false);
} }
BOOST_CATCH(const test_exception&) {} BOOST_CONTAINER_CATCH(const test_exception&) {}
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
test_elem_throw::do_not_throw(); test_elem_throw::do_not_throw();
test_equal_range(a, {1, 2, 3, 4, 5, 6}); test_equal_range(a, {1, 2, 3, 4, 5, 6});

View File

@@ -10,7 +10,6 @@
#include <boost/container/pmr/global_resource.hpp> #include <boost/container/pmr/global_resource.hpp>
#include <boost/container/pmr/memory_resource.hpp> #include <boost/container/pmr/memory_resource.hpp>
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include "derived_from_memory_resource.hpp" #include "derived_from_memory_resource.hpp"
@@ -91,15 +90,15 @@ void test_null_memory_resource()
#if !defined(BOOST_NO_EXCEPTIONS) #if !defined(BOOST_NO_EXCEPTIONS)
bool bad_allocexception_thrown = false; bool bad_allocexception_thrown = false;
BOOST_TRY{ BOOST_CONTAINER_TRY{
mr->allocate(1, 1); mr->allocate(1, 1);
} }
BOOST_CATCH(std::bad_alloc&) { BOOST_CONTAINER_CATCH(std::bad_alloc&) {
bad_allocexception_thrown = true; bad_allocexception_thrown = true;
} }
BOOST_CATCH(...) { BOOST_CONTAINER_CATCH(...) {
} }
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
BOOST_TEST(bad_allocexception_thrown == true); BOOST_TEST(bad_allocexception_thrown == true);
#endif //BOOST_NO_EXCEPTIONS #endif //BOOST_NO_EXCEPTIONS

View File

@@ -9,7 +9,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <boost/container/pmr/memory_resource.hpp> #include <boost/container/pmr/memory_resource.hpp>
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include "derived_from_memory_resource.hpp" #include "derived_from_memory_resource.hpp"
#include <cstdlib> #include <cstdlib>

View File

@@ -10,7 +10,6 @@
#define BOOST_ENABLE_ASSERT_HANDLER #define BOOST_ENABLE_ASSERT_HANDLER
#include <boost/container/static_vector.hpp> #include <boost/container/static_vector.hpp>
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <new> //for bad_alloc #include <new> //for bad_alloc
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <cstdlib> #include <cstdlib>
@@ -87,16 +86,16 @@ void test_throw_on_overflow()
v.resize(Capacity); v.resize(Capacity);
bool expected_type_thrown = false; bool expected_type_thrown = false;
BOOST_TRY{ BOOST_CONTAINER_TRY{
v.push_back(0); v.push_back(0);
} }
BOOST_CATCH(bad_alloc_t&) BOOST_CONTAINER_CATCH(bad_alloc_t&)
{ {
expected_type_thrown = true; expected_type_thrown = true;
} }
BOOST_CATCH(...) BOOST_CONTAINER_CATCH(...)
{} {}
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
BOOST_TEST(expected_type_thrown == true); BOOST_TEST(expected_type_thrown == true);
BOOST_TEST(v.capacity() == Capacity); BOOST_TEST(v.capacity() == Capacity);
@@ -115,16 +114,16 @@ void test_throw_on_overflow()
v.resize(Capacity); v.resize(Capacity);
bool expected_type_thrown = false; bool expected_type_thrown = false;
BOOST_TRY{ BOOST_CONTAINER_TRY{
v.push_back(0); v.push_back(0);
} }
BOOST_CATCH(throw_on_overflow_off) BOOST_CONTAINER_CATCH(throw_on_overflow_off)
{ {
expected_type_thrown = true; expected_type_thrown = true;
} }
BOOST_CATCH(...) BOOST_CONTAINER_CATCH(...)
{} {}
BOOST_CATCH_END BOOST_CONTAINER_CATCH_END
BOOST_TEST(expected_type_thrown == true); BOOST_TEST(expected_type_thrown == true);
BOOST_TEST(v.capacity() == Capacity); BOOST_TEST(v.capacity() == Capacity);

View File

@@ -8,7 +8,6 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
#include <boost/container/list.hpp> #include <boost/container/list.hpp>
#include <boost/container/detail/iterator.hpp> #include <boost/container/detail/iterator.hpp>

View File

@@ -22,7 +22,6 @@
#include <boost/move/utility_core.hpp> #include <boost/move/utility_core.hpp>
#include <boost/move/iterator.hpp> #include <boost/move/iterator.hpp>
#include <boost/move/make_unique.hpp> #include <boost/move/make_unique.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include "print_container.hpp" #include "print_container.hpp"