Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85503 - trunk/boost/geometry/index/detail/rtree
From: adam.wulkiewicz_at_[hidden]
Date: 2013-08-28 15:05:54


Author: awulkiew
Date: 2013-08-28 15:05:53 EDT (Wed, 28 Aug 2013)
New Revision: 85503
URL: http://svn.boost.org/trac/boost/changeset/85503

Log:
[geometry][index] added conditional move semantics to type-erased query iterators, for test purposes

Text files modified:
   trunk/boost/geometry/index/detail/rtree/query_iterators.hpp | 55 +++++++++++++++++++++++++++++++++++++--
   1 files changed, 52 insertions(+), 3 deletions(-)

Modified: trunk/boost/geometry/index/detail/rtree/query_iterators.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/query_iterators.hpp Wed Aug 28 13:55:45 2013 (r85502)
+++ trunk/boost/geometry/index/detail/rtree/query_iterators.hpp 2013-08-28 15:05:53 EDT (Wed, 28 Aug 2013) (r85503)
@@ -11,8 +11,6 @@
 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUERY_ITERATORS_HPP
 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUERY_ITERATORS_HPP
 
-#include <boost/scoped_ptr.hpp>
-
 namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree {
 
 template <typename Value, typename Allocators>
@@ -253,7 +251,7 @@
 class query_iterator_poly
 {
     typedef query_iterator_base<Value, Allocators> iterator_base;
- typedef boost::scoped_ptr<iterator_base> iterator_ptr;
+ typedef std::auto_ptr<iterator_base> iterator_ptr;
 
 public:
     typedef std::input_iterator_tag iterator_category;
@@ -277,11 +275,36 @@
         : m_ptr(o.m_ptr.get() ? o.m_ptr->clone() : 0)
     {}
 
+#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS_MOVE
     query_iterator_poly & operator=(query_iterator_poly const& o)
     {
         m_ptr.reset(o.m_ptr.get() ? o.m_ptr->clone() : 0);
         return *this;
     }
+#else
+private:
+ BOOST_COPYABLE_AND_MOVABLE(query_iterator_poly)
+public:
+ query_iterator_poly & operator=(BOOST_COPY_ASSIGN_REF(query_iterator_poly) o)
+ {
+ m_ptr.reset(o.m_ptr.get() ? o.m_ptr->clone() : 0);
+ return *this;
+ }
+ query_iterator_poly(BOOST_RV_REF(query_iterator_poly) o)
+ : m_ptr(o.m_ptr.get())
+ {
+ o.m_ptr.release();
+ }
+ query_iterator_poly & operator=(BOOST_RV_REF(query_iterator_poly) o)
+ {
+ if ( this != boost::addressof(o) )
+ {
+ m_ptr.reset(o.m_ptr.get());
+ o.m_ptr.get().release();
+ }
+ return *this;
+ }
+#endif
 
     reference operator*() const
     {
@@ -406,6 +429,32 @@
     query_iterator_te(end_query_iterator<Value, Allocators> const& /*it*/)
     {}
 
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS_MOVE
+private:
+ BOOST_COPYABLE_AND_MOVABLE(query_iterator_te)
+public:
+ query_iterator_te(query_iterator_te const& o)
+ : m_iterator(o.m_iterator)
+ {}
+
+ query_iterator_te & operator=(BOOST_COPY_ASSIGN_REF(query_iterator_te) o)
+ {
+ m_iterator = o.m_iterator;
+ return *this;
+ }
+ query_iterator_te(BOOST_RV_REF(query_iterator_te) o)
+ : m_iterator(boost::move(o.m_iterator))
+ {}
+ query_iterator_te & operator=(BOOST_RV_REF(query_iterator_te) o)
+ {
+ if ( this != boost::addressof(o) )
+ {
+ m_iterator = boost::move(o.m_iterator);
+ }
+ return *this;
+ }
+#endif
+
     reference operator*() const
     {
         return *m_iterator;


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