Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83709 - in trunk/boost/geometry/index: . detail
From: adam.wulkiewicz_at_[hidden]
Date: 2013-04-02 10:00:58


Author: awulkiew
Date: 2013-04-02 10:00:57 EDT (Tue, 02 Apr 2013)
New Revision: 83709
URL: http://svn.boost.org/trac/boost/changeset/83709

Log:
rtree: fixed error in move assignment (allocators comparison), some comments added
Text files modified:
   trunk/boost/geometry/index/detail/utilities.hpp | 23 -----------------------
   trunk/boost/geometry/index/rtree.hpp | 17 +++++++++++++++--
   2 files changed, 15 insertions(+), 25 deletions(-)

Modified: trunk/boost/geometry/index/detail/utilities.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/utilities.hpp (original)
+++ trunk/boost/geometry/index/detail/utilities.hpp 2013-04-02 10:00:57 EDT (Tue, 02 Apr 2013)
@@ -32,29 +32,6 @@
 template<class T>
 static inline void move_cond(T &, T &, boost::mpl::bool_<false> const&) {}
 
-// Darwin compiler (tested on 4.2.1) can't copy empty base classes properly!
-// Consider using following functions:
-
-//template <typename T> inline
-//void swap_cond_impl(T &, T &, boost::true_type const& /*is_empty*/) {}
-//
-//template <typename T> inline
-//void swap_cond_impl(T & l, T & r, boost::false_type const& /*is_empty*/)
-//{
-// ::boost::swap(l, r);
-//}
-//
-//template <typename T> inline
-//void swap_cond(T & l, T & r, boost::mpl::bool_<true> const&)
-//{
-//#ifdef BOOST_IS_EMPTY
-// typedef typename ::boost::is_empty<T>::type is_empty;
-//#else
-// typedef ::boost::false_type is_empty;
-//#endif
-// swap_cond_impl(l, r, is_empty());
-//}
-
 template <typename T> inline
 void swap_cond(T & l, T & r, boost::mpl::bool_<true> const&)
 {

Modified: trunk/boost/geometry/index/rtree.hpp
==============================================================================
--- trunk/boost/geometry/index/rtree.hpp (original)
+++ trunk/boost/geometry/index/rtree.hpp 2013-04-02 10:00:57 EDT (Tue, 02 Apr 2013)
@@ -383,9 +383,14 @@
             allocators_type & this_allocs = m_members.allocators();
             allocators_type const& src_allocs = src.m_members.allocators();
 
+ // NOTE: if propagate is true for std allocators on darwin 4.2.1, glibc++
+ // (allocators stored as base classes of members_holder)
+ // copying them changes values_count, in this case it doesn't cause errors since data must be copied
+
             typedef boost::mpl::bool_<
                 allocator_traits_type::propagate_on_container_copy_assignment::value
> propagate;
+
             if ( propagate::value && !(this_allocs == src_allocs) )
                 this->raw_destroy(*this);
             detail::assign_cond(this_allocs, src_allocs, propagate());
@@ -417,7 +422,7 @@
             allocators_type & this_allocs = m_members.allocators();
             allocators_type & src_allocs = src.m_members.allocators();
             
- if ( this_allocs == this_allocs )
+ if ( this_allocs == src_allocs )
             {
                 this->raw_destroy(*this);
 
@@ -429,6 +434,10 @@
                 boost::swap(m_members.leafs_level, src.m_members.leafs_level);
                 boost::swap(m_members.root, src.m_members.root);
 
+ // NOTE: if propagate is true for std allocators on darwin 4.2.1, glibc++
+ // (allocators stored as base classes of members_holder)
+ // moving them changes values_count
+
                 typedef boost::mpl::bool_<
                     allocator_traits_type::propagate_on_container_move_assignment::value
> propagate;
@@ -461,7 +470,11 @@
         boost::swap(m_members.indexable_getter(), other.m_members.indexable_getter());
         boost::swap(m_members.equal_to(), other.m_members.equal_to());
         boost::swap(m_members.parameters(), other.m_members.parameters());
-
+
+ // NOTE: if propagate is true for std allocators on darwin 4.2.1, glibc++
+ // (allocators stored as base classes of members_holder)
+ // swapping them changes values_count
+
         typedef boost::mpl::bool_<
             allocator_traits_type::propagate_on_container_swap::value
> propagate;


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