diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:24:46 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:25:39 +0900 |
commit | 4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch) | |
tree | fd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/signals2/detail/auto_buffer.hpp | |
parent | b5c87084afaef42b2d058f68091be31988a6a874 (diff) | |
download | boost-upstream/1.65.0.tar.gz boost-upstream/1.65.0.tar.bz2 boost-upstream/1.65.0.zip |
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/signals2/detail/auto_buffer.hpp')
-rw-r--r-- | boost/signals2/detail/auto_buffer.hpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/boost/signals2/detail/auto_buffer.hpp b/boost/signals2/detail/auto_buffer.hpp index 4c55a751ae..5ff8dd2c63 100644 --- a/boost/signals2/detail/auto_buffer.hpp +++ b/boost/signals2/detail/auto_buffer.hpp @@ -248,6 +248,14 @@ namespace detail auto_buffer_destroy( where, boost::has_trivial_destructor<T>() ); } + void auto_buffer_destroy() + { + BOOST_ASSERT( is_valid() ); + if( buffer_ ) // do we need this check? Yes, but only + // for N = 0u + local instances in one_sided_swap() + auto_buffer_destroy( boost::has_trivial_destructor<T>() ); + } + void destroy_back_n( size_type n, const boost::false_type& ) { BOOST_ASSERT( n > 0 ); @@ -301,7 +309,7 @@ namespace detail { pointer new_buffer = move_to_new_buffer( new_capacity, boost::has_nothrow_copy<T>() ); - (*this).~auto_buffer(); + auto_buffer_destroy(); buffer_ = new_buffer; members_.capacity_ = new_capacity; BOOST_ASSERT( size_ <= members_.capacity_ ); @@ -355,7 +363,7 @@ namespace detail void one_sided_swap( auto_buffer& temp ) // nothrow { BOOST_ASSERT( !temp.is_on_stack() ); - this->~auto_buffer(); + auto_buffer_destroy(); // @remark: must be nothrow get_allocator() = temp.get_allocator(); members_.capacity_ = temp.members_.capacity_; @@ -506,7 +514,7 @@ namespace detail { // @remark: we release memory as early as possible // since we only give the basic guarantee - (*this).~auto_buffer(); + auto_buffer_destroy(); buffer_ = 0; pointer new_buffer = allocate( r.size() ); boost::multi_index::detail::scope_guard guard = @@ -597,10 +605,7 @@ namespace detail ~auto_buffer() { - BOOST_ASSERT( is_valid() ); - if( buffer_ ) // do we need this check? Yes, but only - // for N = 0u + local instances in one_sided_swap() - auto_buffer_destroy( boost::has_trivial_destructor<T>() ); + auto_buffer_destroy(); } public: @@ -1033,7 +1038,7 @@ namespace detail pointer new_buffer = static_cast<T*>(other->members_.address()); copy_impl( one_on_stack->begin(), one_on_stack->end(), new_buffer ); // strong - one_on_stack->~auto_buffer(); // nothrow + one_on_stack->auto_buffer_destroy(); // nothrow boost::swap( get_allocator(), r.get_allocator() ); // assume nothrow boost::swap( members_.capacity_, r.members_.capacity_ ); boost::swap( size_, r.size_ ); |