|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76264 - in branches/release/boost: container container/detail interprocess interprocess/smart_ptr/detail intrusive intrusive/detail
From: igaztanaga_at_[hidden]
Date: 2012-01-01 14:14:13
Author: igaztanaga
Date: 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
New Revision: 76264
URL: http://svn.boost.org/trac/boost/changeset/76264
Log:
Fixes from trunk for 1.49
Properties modified:
branches/release/boost/interprocess/ (props changed)
branches/release/boost/intrusive/ (props changed)
Text files modified:
branches/release/boost/container/deque.hpp | 36 +++++++++--
branches/release/boost/container/detail/algorithms.hpp | 123 ----------------------------------------
branches/release/boost/container/stable_vector.hpp | 13 ++-
branches/release/boost/container/string.hpp | 38 ++++++++++--
branches/release/boost/container/vector.hpp | 2
branches/release/boost/interprocess/smart_ptr/detail/shared_count.hpp | 10 ++
branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp | 18 ++++-
branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp | 3
8 files changed, 90 insertions(+), 153 deletions(-)
Modified: branches/release/boost/container/deque.hpp
==============================================================================
--- branches/release/boost/container/deque.hpp (original)
+++ branches/release/boost/container/deque.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -1069,7 +1069,10 @@
{
if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
--this->members_.m_finish.m_cur;
- container_detail::to_raw_pointer(this->members_.m_finish.m_cur)->~value_type();
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
+ );
}
else
this->priv_pop_back_aux();
@@ -1083,7 +1086,10 @@
void pop_front() BOOST_CONTAINER_NOEXCEPT
{
if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
- container_detail::to_raw_pointer(this->members_.m_start.m_cur)->~value_type();
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
+ );
++this->members_.m_start.m_cur;
}
else
@@ -1598,14 +1604,22 @@
void priv_destroy_range(iterator p, iterator p2)
{
- for(;p != p2; ++p)
- container_detail::to_raw_pointer(&*p)->~value_type();
+ for(;p != p2; ++p){
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(&*p)
+ );
+ }
}
void priv_destroy_range(pointer p, pointer p2)
{
- for(;p != p2; ++p)
- container_detail::to_raw_pointer(&*p)->~value_type();
+ for(;p != p2; ++p){
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(&*p)
+ );
+ }
}
template <class Integer>
@@ -1827,7 +1841,10 @@
this->priv_deallocate_node(this->members_.m_finish.m_first);
this->members_.m_finish.priv_set_node(this->members_.m_finish.m_node - 1);
this->members_.m_finish.m_cur = this->members_.m_finish.m_last - 1;
- container_detail::to_raw_pointer(this->members_.m_finish.m_cur)->~value_type();
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
+ );
}
// Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that
@@ -1836,7 +1853,10 @@
// must have at least two nodes.
void priv_pop_front_aux()
{
- container_detail::to_raw_pointer(this->members_.m_start.m_cur)->~value_type();
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
+ );
this->priv_deallocate_node(this->members_.m_start.m_first);
this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);
this->members_.m_start.m_cur = this->members_.m_start.m_first;
Modified: branches/release/boost/container/detail/algorithms.hpp
==============================================================================
--- branches/release/boost/container/detail/algorithms.hpp (original)
+++ branches/release/boost/container/detail/algorithms.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -50,130 +50,7 @@
{
ei.construct_in_place(a, dest);
}
-/*
-template<class InIt, class OutIt>
-struct optimize_assign
-{
- static const bool value = false;
-};
-
-template<class T>
-struct optimize_assign<const T*, T*>
-{
- static const bool value = boost::has_trivial_assign<T>::value;
-};
-
-template<class T>
-struct optimize_assign<T*, T*>
- : public optimize_assign<const T*, T*>
-{};
-
-template<class InIt, class OutIt>
-struct optimize_copy
-{
- static const bool value = false;
-};
-
-template<class T>
-struct optimize_copy<const T*, T*>
-{
- static const bool value = boost::has_trivial_copy<T>::value;
-};
-
-template<class T>
-struct optimize_copy<T*, T*>
- : public optimize_copy<const T*, T*>
-{};
-
-template<class InIt, class OutIt> inline
-OutIt copy_n_dispatch(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest, container_detail::bool_<false>)
-{
- for (; length--; ++dest, ++first)
- *dest = *first;
- return dest;
-}
-
-template<class T> inline
-T *copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, container_detail::bool_<true>)
-{
- std::size_t size = length*sizeof(T);
- return (static_cast<T*>(std::memmove(dest, first, size))) + size;
-}
-template<class InIt, class OutIt> inline
-OutIt copy_n(InIt first, typename std::iterator_traits<InIt>::difference_type length, OutIt dest)
-{
- const bool do_optimized_assign = optimize_assign<InIt, OutIt>::value;
- return copy_n_dispatch(first, length, dest, container_detail::bool_<do_optimized_assign>());
-}
-
-template<class InIt, class FwdIt> inline
-FwdIt uninitialized_copy_n_dispatch
- (InIt first,
- typename std::iterator_traits<InIt>::difference_type count,
- FwdIt dest, container_detail::bool_<false>)
-{
- typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- //Save initial destination position
- FwdIt dest_init = dest;
- typename std::iterator_traits<InIt>::difference_type new_count = count+1;
-
- BOOST_TRY{
- //Try to build objects
- for (; --new_count; ++dest, ++first){
- construct_in_place(container_detail::to_raw_pointer(&*dest), first);
- }
- }
- BOOST_CATCH(...){
- //Call destructors
- new_count = count - new_count;
- for (; new_count--; ++dest_init){
- container_detail::to_raw_pointer(&*dest_init)->~value_type();
- }
- BOOST_RETHROW
- }
- BOOST_CATCH_END
- return dest;
-}
-template<class T> inline
-T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, container_detail::bool_<true>)
-{
- std::size_t size = length*sizeof(T);
- return (static_cast<T*>(std::memmove(dest, first, size))) + size;
-}
-
-template<class InIt, class FwdIt> inline
-FwdIt uninitialized_copy_n
- (InIt first,
- typename std::iterator_traits<InIt>::difference_type count,
- FwdIt dest)
-{
- const bool do_optimized_copy = optimize_copy<InIt, FwdIt>::value;
- return uninitialized_copy_n_dispatch(first, count, dest, container_detail::bool_<do_optimized_copy>());
-}
-
-// uninitialized_copy_copy
-// Copies [first1, last1) into [result, result + (last1 - first1)), and
-// copies [first2, last2) into
-// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)).
-template <class InpIt1, class InpIt2, class FwdIt>
-FwdIt uninitialized_copy_copy
- (InpIt1 first1, InpIt1 last1, InpIt2 first2, InpIt2 last2, FwdIt result)
-{
- typedef typename std::iterator_traits<FwdIt>::value_type value_type;
- FwdIt mid = std::uninitialized_copy(first1, last1, result);
- BOOST_TRY {
- return std::uninitialized_copy(first2, last2, mid);
- }
- BOOST_CATCH(...){
- for(;result != mid; ++result){
- container_detail::to_raw_pointer(&*result)->~value_type();
- }
- BOOST_RETHROW
- }
- BOOST_CATCH_END
-}
-*/
} //namespace container {
} //namespace boost {
Modified: branches/release/boost/container/stable_vector.hpp
==============================================================================
--- branches/release/boost/container/stable_vector.hpp (original)
+++ branches/release/boost/container/stable_vector.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -446,7 +446,7 @@
template<class AllocatorVersion>
node_type_ptr_t allocate_one(AllocatorVersion,
typename boost::container::container_detail::enable_if_c
- <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ <!boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
::value>::type * = 0)
{ return node_alloc().allocate_one(); }
@@ -463,7 +463,7 @@
template<class AllocatorVersion>
void deallocate_one(node_type_ptr_t p, AllocatorVersion,
typename boost::container::container_detail::enable_if_c
- <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ <!boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
::value>::type * = 0)
{ node_alloc().deallocate_one(p); }
@@ -1316,7 +1316,7 @@
template<class AllocatorVersion>
void clear_pool(AllocatorVersion,
typename boost::container::container_detail::enable_if_c
- <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ <!boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
::value>::type * = 0)
{
if(!impl.empty() && impl.back()){
@@ -1355,7 +1355,7 @@
template<class AllocatorVersion>
void add_to_pool(size_type n, AllocatorVersion,
typename boost::container::container_detail::enable_if_c
- <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ <!boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
::value>::type * = 0)
{
void_ptr &pool_first_ref = impl.end()[-2];
@@ -1473,7 +1473,7 @@
template<class AllocatorVersion>
iterator priv_erase(const_iterator first, const_iterator last, AllocatorVersion,
typename boost::container::container_detail::enable_if_c
- <boost::container::container_detail::is_same<AllocatorVersion, allocator_v2>
+ <!boost::container::container_detail::is_same<AllocatorVersion, allocator_v1>
::value>::type * = 0)
{
STABLE_VECTOR_CHECK_INVARIANT;
@@ -1542,7 +1542,8 @@
void delete_node(const void_ptr &p)
{
node_type_ptr_t n(node_ptr_cast(p));
- n->~node_type_t();
+ allocator_traits<node_allocator_type>::
+ destroy(this->node_alloc(), container_detail::to_raw_pointer(n));
this->put_in_pool(n);
}
Modified: branches/release/boost/container/string.hpp
==============================================================================
--- branches/release/boost/container/string.hpp (original)
+++ branches/release/boost/container/string.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -127,7 +127,10 @@
{
if(!this->is_short()){
this->deallocate_block();
- static_cast<long_t*>(static_cast<void*>(&this->members_.m_repr.r))->~long_t();
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , static_cast<long_t*>(static_cast<void*>(&this->members_.m_repr.r))
+ );
}
}
@@ -240,10 +243,16 @@
void is_short(bool yes)
{
if(yes && !this->is_short()){
- static_cast<long_t*>(static_cast<void*>(&this->members_.m_repr.r))->~long_t();
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , static_cast<long_t*>(static_cast<void*>(&this->members_.m_repr.r))
+ );
}
else{
- new(static_cast<void*>(&this->members_.m_repr.r))long_t();
+ allocator_traits_type::construct
+ ( this->alloc()
+ , static_cast<long_t*>(static_cast<void*>(&this->members_.m_repr.r))
+ );
}
this->members_.m_repr.s.h.is_short = yes;
}
@@ -314,16 +323,31 @@
}
void construct(pointer p, const value_type &value = value_type())
- { new((void*)container_detail::to_raw_pointer(p)) value_type(value); }
+ {
+ allocator_traits_type::construct
+ ( this->alloc()
+ , container_detail::to_raw_pointer(p)
+ , value
+ );
+ }
void destroy(pointer p, size_type n)
{
- for(; n--; ++p)
- container_detail::to_raw_pointer(p)->~value_type();
+ for(; n--; ++p){
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(p)
+ );
+ }
}
void destroy(pointer p)
- { container_detail::to_raw_pointer(p)->~value_type(); }
+ {
+ allocator_traits_type::destroy
+ ( this->alloc()
+ , container_detail::to_raw_pointer(p)
+ );
+ }
void allocate_initial_block(size_type n)
{
Modified: branches/release/boost/container/vector.hpp
==============================================================================
--- branches/release/boost/container/vector.hpp (original)
+++ branches/release/boost/container/vector.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -1328,7 +1328,7 @@
template<class AllocVersion>
void priv_shrink_to_fit(AllocVersion
, typename container_detail::enable_if_c<
- container_detail::is_same<AllocVersion, allocator_v2>::value >::type * = 0)
+ !container_detail::is_same<AllocVersion, allocator_v1>::value >::type * = 0)
{
if(this->members_.m_capacity){
if(!size()){
Modified: branches/release/boost/interprocess/smart_ptr/detail/shared_count.hpp
==============================================================================
--- branches/release/boost/interprocess/smart_ptr/detail/shared_count.hpp (original)
+++ branches/release/boost/interprocess/smart_ptr/detail/shared_count.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -28,6 +28,7 @@
#include <boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp>
#include <boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp>
#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <functional> // std::less
@@ -54,9 +55,12 @@
rebind_pointer<counted_impl>::type counted_impl_ptr;
typedef typename boost::intrusive::
pointer_traits<typename VoidAllocator::pointer>::template
- rebind_pointer<sp_counted_base>::type counted_base_ptr;
- typedef typename VoidAllocator::template rebind
- <counted_impl>::other counted_impl_allocator;
+ rebind_pointer<sp_counted_base>::type counted_base_ptr;
+
+ typedef boost::container::allocator_traits<VoidAllocator> vallocator_traits;
+
+ typedef typename vallocator_traits::template
+ portable_rebind_alloc<counted_impl>::type counted_impl_allocator;
typedef typename boost::intrusive::
pointer_traits<typename VoidAllocator::pointer>::template
Modified: branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp (original)
+++ branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -26,6 +26,7 @@
#include <boost/interprocess/smart_ptr/detail/sp_counted_base.hpp>
#include <boost/interprocess/smart_ptr/scoped_ptr.hpp>
#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/container/allocator/allocator_traits.hpp>
#include <boost/intrusive/pointer_traits.hpp>
namespace boost {
@@ -62,18 +63,25 @@
{ if (ptr) priv_deallocate(ptr, alloc_version()); }
};
+
+
template<class A, class D>
class sp_counted_impl_pd
: public sp_counted_base
- , A::template rebind< sp_counted_impl_pd<A, D> >::other
+ , boost::container::allocator_traits<A>::template
+ portable_rebind_alloc< sp_counted_impl_pd<A, D> >::type
, D // copy constructor must not throw
{
private:
typedef sp_counted_impl_pd<A, D> this_type;
- typedef typename A::template rebind
- <this_type>::other this_allocator;
- typedef typename A::template rebind
- <const this_type>::other const_this_allocator;
+ typedef typename boost::container::
+ allocator_traits<A>::template
+ portable_rebind_alloc
+ < this_type >::type this_allocator;
+ typedef typename boost::container::
+ allocator_traits<A>::template
+ portable_rebind_alloc
+ < const this_type >::type const_this_allocator;
typedef typename this_allocator::pointer this_pointer;
sp_counted_impl_pd( sp_counted_impl_pd const & );
Modified: branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp (original)
+++ branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp 2012-01-01 14:14:12 EST (Sun, 01 Jan 2012)
@@ -25,6 +25,8 @@
//wrong SFINAE for GCC 4.2/4.3
#if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430)
#define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED
+ #elif defined(BOOST_INTEL) && (BOOST_INTEL < 1200 )
+ #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED
#endif
namespace boost_intrusive_has_member_function_callable_with {
@@ -125,6 +127,7 @@
};
#else
+
//Special case for 0 args
template< class F
, std::size_t N =
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk