Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82917 - in sandbox-branches/geometry/index/boost/geometry/index: . detail/rtree/node detail/rtree/visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2013-02-15 19:04:04


Author: awulkiew
Date: 2013-02-15 19:04:03 EST (Fri, 15 Feb 2013)
New Revision: 82917
URL: http://svn.boost.org/trac/boost/changeset/82917

Log:
rtree object size decreased, bounds returned by copy, rtree members grouped in members_holder derived from potentially empty types
Text files modified:
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node.hpp | 8
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/children_box.hpp | 4
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp | 19 --
   sandbox-branches/geometry/index/boost/geometry/index/rtree.hpp | 319 +++++++++++++++++++--------------------
   4 files changed, 162 insertions(+), 188 deletions(-)

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node.hpp 2013-02-15 19:04:03 EST (Fri, 15 Feb 2013)
@@ -34,10 +34,14 @@
 template <typename Box, typename FwdIter, typename Translator>
 inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr)
 {
- BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box");
-
     Box result;
 
+ if ( first == last )
+ {
+ geometry::assign_inverse(result);
+ return result;
+ }
+
     geometry::convert(element_indexable(*first, tr), result);
     ++first;
 

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/children_box.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/children_box.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/children_box.hpp 2013-02-15 19:04:03 EST (Fri, 15 Feb 2013)
@@ -11,7 +11,7 @@
 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP
 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP
 
-#include <boost/geometry/index/rtree/node/node.hpp>
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
 
 namespace boost { namespace geometry { namespace index {
 
@@ -20,7 +20,7 @@
 template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
 class children_box
     : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
- , index::nonassignable
+ , index::detail::nonassignable
 {
     typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
     typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;

Modified: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp 2013-02-15 19:04:03 EST (Fri, 15 Feb 2013)
@@ -40,7 +40,6 @@
 public:
     inline remove(node_pointer & root,
                   size_t & leafs_level,
- Box & root_box,
                   Value const& value,
                   parameters_type const& parameters,
                   Translator const& translator,
@@ -50,7 +49,6 @@
         , m_translator(translator)
         , m_allocators(allocators)
         , m_root_node(root)
- , m_root_box(root_box)
         , m_leafs_level(leafs_level)
         , m_is_value_removed(false)
         , m_parent(0)
@@ -114,9 +112,6 @@
             {
                 BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get<internal_node>(*m_root_node), "node must be the root");
 
- // assign new root's box
- assign_root_box(elements);
-
                 // reinsert elements from removed nodes (underflows)
                 reinsert_removed_nodes_elements(); // MAY THROW (V, E: alloc, copy, N: alloc)
 
@@ -162,10 +157,6 @@
                 rtree::elements(*m_parent)[m_current_child_index].first
                     = rtree::elements_box<Box>(elements.begin(), elements.end(), m_translator);
             }
- else
- {
- assign_root_box(elements);
- }
         }
     }
 
@@ -296,22 +287,12 @@
         }
     }
 
- template <typename Elements>
- void assign_root_box(Elements const& elements)
- {
- if ( elements.empty() )
- geometry::assign_inverse(m_root_box);
- else
- m_root_box = rtree::elements_box<Box>(elements.begin(), elements.end(), m_translator);
- }
-
     Value const& m_value;
     parameters_type const& m_parameters;
     Translator const& m_translator;
     Allocators & m_allocators;
 
     node_pointer & m_root_node;
- Box & m_root_box;
     size_t & m_leafs_level;
 
     bool m_is_value_removed;

Modified: sandbox-branches/geometry/index/boost/geometry/index/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/index/rtree.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/index/rtree.hpp 2013-02-15 19:04:03 EST (Fri, 15 Feb 2013)
@@ -40,6 +40,7 @@
 #include <boost/geometry/index/detail/rtree/visitors/spatial_query.hpp>
 #include <boost/geometry/index/detail/rtree/visitors/nearest_query.hpp>
 #include <boost/geometry/index/detail/rtree/visitors/count.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/children_box.hpp>
 
 #include <boost/geometry/index/detail/rtree/linear/linear.hpp>
 #include <boost/geometry/index/detail/rtree/quadratic/quadratic.hpp>
@@ -146,15 +147,8 @@
     */
     inline explicit rtree(parameters_type parameters = parameters_type(),
                           translator_type const& translator = translator_type())
- : m_translator(translator) // SHOULDN'T THROW
- , m_parameters(parameters)
- , m_allocators()
- , m_values_count(0)
- , m_leafs_level(0)
- , m_root(0)
- {
- geometry::assign_inverse(m_box);
- }
+ : m_members(translator, parameters)
+ {}
 
     /*!
     \brief The constructor.
@@ -169,15 +163,8 @@
     inline rtree(parameters_type parameters,
                  translator_type const& translator,
                  allocator_type allocator)
- : m_translator(translator) // SHOULDN'T THROW
- , m_parameters(parameters)
- , m_allocators(allocator)
- , m_values_count(0)
- , m_leafs_level(0)
- , m_root(0)
- {
- geometry::assign_inverse(m_box);
- }
+ : m_members(translator, parameters, allocator)
+ {}
 
     /*!
     \brief The constructor.
@@ -199,15 +186,8 @@
                  parameters_type parameters = parameters_type(),
                  translator_type const& translator = translator_type(),
                  allocator_type allocator = allocator_type())
- : m_translator(translator) // SHOULDN'T THROW
- , m_parameters(parameters)
- , m_allocators(allocator)
- , m_values_count(0)
- , m_leafs_level(0)
- , m_root(0)
+ : m_members(translator, parameters, allocator)
     {
- geometry::assign_inverse(m_box);
-
         try
         {
             this->insert(first, last);
@@ -238,15 +218,8 @@
                           parameters_type parameters = parameters_type(),
                           translator_type const& translator = translator_type(),
                           allocator_type allocator = allocator_type())
- : m_translator(translator) // SHOULDN'T THROW
- , m_parameters(parameters)
- , m_allocators(allocator)
- , m_values_count(0)
- , m_leafs_level(0)
- , m_root(0)
+ : m_members(translator, parameters, allocator)
     {
- geometry::assign_inverse(m_box);
-
         try
         {
             this->insert(rng);
@@ -283,13 +256,7 @@
     \li When memory allocation for Node fails.
     */
     inline rtree(rtree const& src)
- : m_translator(src.m_translator) // SHOULDN'T THROW
- , m_parameters(src.m_parameters)
- , m_allocators(src.m_allocators)
- , m_values_count(0)
- , m_leafs_level(0)
- , m_root(0)
- , m_box(src.m_box)
+ : m_members(src.m_members.translator(), src.m_members.parameters(), src.m_members.allocators())
     {
         //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction()
         this->raw_copy(src, *this, false);
@@ -310,13 +277,7 @@
     \li When memory allocation for Node fails.
     */
     inline rtree(rtree const& src, allocator_type const& allocator)
- : m_translator(src.m_translator) // SHOULDN'T THROW
- , m_parameters(src.m_parameters)
- , m_allocators(allocator)
- , m_values_count(0)
- , m_leafs_level(0)
- , m_root(0)
- , m_box(src.m_box)
+ : m_members(src.m_members.translator(), src.m_members.parameters(), allocator)
     {
         this->raw_copy(src, *this, false);
     }
@@ -332,18 +293,13 @@
     Nothing.
     */
     inline rtree(BOOST_RV_REF(rtree) src)
-// TODO - use boost::move()
- : m_translator(src.m_translator) // SHOULDN'T THROW
- , m_parameters(src.m_parameters)
- , m_allocators(src.m_allocators)
- , m_values_count(src.m_values_count)
- , m_leafs_level(src.m_leafs_level)
- , m_root(src.m_root)
- , m_box(src.m_box)
- {
- src.m_values_count = 0;
- src.m_leafs_level = 0;
- src.m_root = 0;
+ : m_members(src.m_members.translator(),
+ src.m_members.parameters(),
+ boost::move(src.m_members.allocators()))
+ {
+ boost::swap(m_members.values_count, src.m_members.values_count);
+ boost::swap(m_members.leafs_level, src.m_members.leafs_level);
+ boost::swap(m_members.root, src.m_members.root);
     }
 
     /*!
@@ -361,20 +317,15 @@
     \li When memory allocation for Node fails (only if allocators aren't equal).
     */
     inline rtree(BOOST_RV_REF(rtree) src, allocator_type const& allocator)
-// TODO - use boost::move()
- : m_translator(src.m_translator) // SHOULDN'T THROW
- , m_parameters(src.m_parameters)
- , m_allocators(allocator)
- , m_values_count(0)
- , m_leafs_level(0)
- , m_root(0)
- , m_box(src.m_box)
+ : m_members(src.m_members.translator(),
+ src.m_members.parameters(),
+ boost::move(allocator))
     {
- if ( src.m_allocators.allocator == allocator )
+ if ( src.m_members.allocators().allocator == allocator )
         {
- boost::swap(m_values_count, src.m_values_count);
- boost::swap(m_leafs_level, src.m_leafs_level);
- boost::swap(m_root, src.m_root);
+ boost::swap(m_members.values_count, src.m_members.values_count);
+ boost::swap(m_members.leafs_level, src.m_members.leafs_level);
+ boost::swap(m_members.root, src.m_members.root);
         }
         else
         {
@@ -404,8 +355,6 @@
         // It uses m_allocators
         this->raw_copy(src, *this, true);
 
- m_box = src.m_box;
-
         return *this;
     }
 
@@ -429,20 +378,16 @@
 
 //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment
 
- if ( m_allocators.allocator == src.m_allocators.allocator )
+ if ( m_members.allocators().allocator == src.m_members.allocators().allocator )
         {
-// TODO - use boost::move()
- m_translator = src.m_translator; // SHOULDN'T THROW
- m_parameters = src.m_parameters;
- //m_allocators = src.m_allocators;
-
- m_values_count = src.m_values_count;
- m_leafs_level = src.m_leafs_level;
- m_root = src.m_root;
-
- src.m_values_count = 0;
- src.m_leafs_level = 0;
- src.m_root = 0;
+ m_members.translator() = src.m_members.translator();
+ m_members.parameters() = src.m_members.parameters();
+
+ this->raw_destroy(*this);
+
+ boost::swap(m_members.values_count, src.m_members.values_count);
+ boost::swap(m_members.leafs_level, src.m_members.leafs_level);
+ boost::swap(m_members.root, src.m_members.root);
         }
         else
         {
@@ -450,8 +395,6 @@
             this->raw_copy(src, *this, true);
         }
 
- m_box = src.m_box;
-
         return *this;
     }
 
@@ -467,14 +410,13 @@
     */
     void swap(rtree & other)
     {
- boost::swap(m_translator, other.m_translator); // SHOULDN'T THROW
- boost::swap(m_parameters, other.m_parameters);
- m_allocators.swap(other.m_allocators);
-
- boost::swap(m_values_count, other.m_values_count);
- boost::swap(m_leafs_level, other.m_leafs_level);
- boost::swap(m_root, other.m_root);
- boost::swap(m_box, other.m_box);
+ boost::swap(m_members.translator(), other.m_members.translator());
+ boost::swap(m_members.parameters(), other.m_members.parameters());
+ m_members.allocators().swap(other.m_members.allocators());
+
+ boost::swap(m_members.values_count, other.m_members.values_count);
+ boost::swap(m_members.leafs_level, other.m_members.leafs_level);
+ boost::swap(m_members.root, other.m_members.root);
     }
 
     /*!
@@ -493,7 +435,7 @@
     */
     inline void insert(value_type const& value)
     {
- if ( !m_root )
+ if ( !m_members.root )
             this->raw_create();
 
         this->raw_insert(value);
@@ -517,7 +459,7 @@
     template <typename Iterator>
     inline void insert(Iterator first, Iterator last)
     {
- if ( !m_root )
+ if ( !m_members.root )
             this->raw_create();
 
         for ( ; first != last ; ++first )
@@ -541,7 +483,7 @@
     template <typename Range>
     inline void insert(Range const& rng)
     {
- if ( !m_root )
+ if ( !m_members.root )
             this->raw_create();
 
         typedef typename boost::range_const_iterator<Range>::type It;
@@ -702,7 +644,7 @@
     template <typename Predicates, typename OutIter>
     size_type query(Predicates const& predicates, OutIter out_it) const
     {
- if ( !m_root )
+ if ( !m_members.root )
             return 0;
 
         static const unsigned nearest_count = detail::predicates_count_nearest<Predicates>::value;
@@ -722,7 +664,7 @@
     */
     inline size_type size() const
     {
- return m_values_count;
+ return m_members.values_count;
     }
 
     /*!
@@ -735,7 +677,7 @@
     */
     inline bool empty() const
     {
- return 0 == m_values_count;
+ return 0 == m_members.values_count;
     }
 
     /*!
@@ -747,7 +689,6 @@
     inline void clear()
     {
         this->raw_destroy(*this);
- geometry::assign_inverse(m_box);
     }
 
     /*!
@@ -762,9 +703,20 @@
     \par Throws
     Nothing.
     */
- inline bounds_type const& bounds() const
+ inline bounds_type bounds() const
     {
- return m_box;
+ bounds_type result;
+ if ( !m_members.root )
+ {
+ geometry::assign_inverse(result);
+ return result;
+ }
+
+ detail::rtree::visitors::children_box<value_type, options_type, translator_wrapper, box_type, allocators_type>
+ box_v(result, m_members.translator());
+ detail::rtree::apply_visitor(box_v, *m_members.root);
+
+ return result;
     }
 
     /*!
@@ -783,13 +735,13 @@
     template <typename ValueOrIndexable>
     size_type count(ValueOrIndexable const& vori) const
     {
- if ( !m_root )
+ if ( !m_members.root )
             return 0;
 
         detail::rtree::visitors::count<ValueOrIndexable, value_type, options_type, translator_wrapper, box_type, allocators_type>
- count_v(vori, m_translator);
+ count_v(vori, m_members.translator());
 
- detail::rtree::apply_visitor(count_v, *m_root);
+ detail::rtree::apply_visitor(count_v, *m_members.root);
 
         return count_v.found_count;
     }
@@ -804,7 +756,7 @@
     */
     inline parameters_type const& parameters() const
     {
- return m_parameters;
+ return m_members.parameters();
     }
 
     /*!
@@ -817,7 +769,7 @@
     */
     inline translator_type const& translator() const
     {
- return m_translator;
+ return m_members.translator();
     }
 
     /*!
@@ -830,7 +782,7 @@
     */
     allocator_type get_allocator() const
     {
- return m_allocators.allocator;
+ return m_members.allocators().allocator;
     }
 
 #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE)
@@ -850,8 +802,8 @@
     template <typename Visitor>
     inline void apply_visitor(Visitor & visitor) const
     {
- if ( m_root )
- detail::rtree::apply_visitor(visitor, *m_root);
+ if ( m_members.root )
+ detail::rtree::apply_visitor(visitor, *m_members.root);
     }
 
     /*!
@@ -866,7 +818,7 @@
     */
     inline size_type values_count() const
     {
- return m_values_count;
+ return m_members.values_count;
     }
 
     /*!
@@ -881,7 +833,7 @@
     */
     inline size_type depth() const
     {
- return m_leafs_level;
+ return m_members.leafs_level;
     }
 
 private:
@@ -897,18 +849,17 @@
     */
     inline void raw_insert(value_type const& value)
     {
- BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist");
- BOOST_GEOMETRY_INDEX_ASSERT(detail::is_valid(m_translator(value)), "Indexable is invalid");
-
- geometry::expand(m_box, m_translator(value));
+ BOOST_GEOMETRY_INDEX_ASSERT(m_members.root, "The root must exist");
+ BOOST_GEOMETRY_INDEX_ASSERT(detail::is_valid(m_members.translator()(value)), "Indexable is invalid");
 
         detail::rtree::visitors::insert<
             value_type,
             value_type, options_type, translator_wrapper, box_type, allocators_type,
             typename options_type::insert_tag
- > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators);
+ > insert_v(m_members.root, m_members.leafs_level, value,
+ m_members.parameters(), m_members.translator(), m_members.allocators());
 
- detail::rtree::apply_visitor(insert_v, *m_root);
+ detail::rtree::apply_visitor(insert_v, *m_members.root);
 
 // TODO
 // Think about this: If exception is thrown, may the root be removed?
@@ -916,7 +867,7 @@
 
 // TODO
 // If exception is thrown, m_values_count may be invalid
- ++m_values_count;
+ ++m_members.values_count;
     }
 
     /*!
@@ -930,21 +881,22 @@
     inline size_type raw_remove(value_type const& value)
     {
         // TODO: awulkiew - assert for correct value (indexable) ?
- BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist");
+ BOOST_GEOMETRY_INDEX_ASSERT(m_members.root, "The root must exist");
 
         detail::rtree::visitors::remove<
             value_type, options_type, translator_wrapper, box_type, allocators_type
- > remove_v(m_root, m_leafs_level, m_box, value, m_parameters, m_translator, m_allocators);
+ > remove_v(m_members.root, m_members.leafs_level, value,
+ m_members.parameters(), m_members.translator(), m_members.allocators());
 
- detail::rtree::apply_visitor(remove_v, *m_root);
+ detail::rtree::apply_visitor(remove_v, *m_members.root);
 
         // If exception is thrown, m_values_count may be invalid
 
         if ( remove_v.is_value_removed() )
         {
- BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "unexpected state");
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_members.values_count, "unexpected state");
 
- --m_values_count;
+ --m_members.values_count;
 
             return 1;
         }
@@ -960,11 +912,11 @@
     */
     inline void raw_create()
     {
- BOOST_GEOMETRY_INDEX_ASSERT(0 == m_root, "the tree is already created");
+ BOOST_GEOMETRY_INDEX_ASSERT(0 == m_members.root, "the tree is already created");
 
- m_root = detail::rtree::create_node<allocators_type, leaf>::apply(m_allocators); // MAY THROW (N: alloc)
- m_values_count = 0;
- m_leafs_level = 0;
+ m_members.root = detail::rtree::create_node<allocators_type, leaf>::apply(m_members.allocators()); // MAY THROW (N: alloc)
+ m_members.values_count = 0;
+ m_members.leafs_level = 0;
     }
 
     /*!
@@ -977,15 +929,16 @@
     */
     inline void raw_destroy(rtree & t)
     {
- if ( t.m_root )
+ if ( t.m_members.root )
         {
- detail::rtree::visitors::destroy<value_type, options_type, translator_wrapper, box_type, allocators_type> del_v(t.m_root, t.m_allocators);
- detail::rtree::apply_visitor(del_v, *t.m_root);
+ detail::rtree::visitors::destroy<value_type, options_type, translator_wrapper, box_type, allocators_type>
+ del_v(t.m_members.root, t.m_members.allocators());
+ detail::rtree::apply_visitor(del_v, *t.m_members.root);
 
- t.m_root = 0;
+ t.m_members.root = 0;
         }
- t.m_values_count = 0;
- t.m_leafs_level = 0;
+ t.m_members.values_count = 0;
+ t.m_members.leafs_level = 0;
     }
 
     /*!
@@ -1000,29 +953,29 @@
     */
     inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const
     {
- detail::rtree::visitors::copy<value_type, options_type, translator_wrapper, box_type, allocators_type> copy_v(dst.m_allocators);
+ detail::rtree::visitors::copy<value_type, options_type, translator_wrapper, box_type, allocators_type>
+ copy_v(dst.m_members.allocators());
 
- if ( src.m_root )
- detail::rtree::apply_visitor(copy_v, *src.m_root); // MAY THROW (V, E: alloc, copy, N: alloc)
+ if ( src.m_members.root )
+ detail::rtree::apply_visitor(copy_v, *src.m_members.root); // MAY THROW (V, E: alloc, copy, N: alloc)
 
         if ( copy_all_internals )
         {
- dst.m_translator = src.m_translator; // SHOULDN'T THROW
-
- dst.m_parameters = src.m_parameters;
- //dst.m_allocators = dst.m_allocators;
+ dst.m_members.translator() = src.m_members.translator(); // SHOULDN'T THROW
+ dst.m_members.parameters() = src.m_members.parameters();
         }
 
- if ( dst.m_root )
+ if ( dst.m_members.root )
         {
- detail::rtree::visitors::destroy<value_type, options_type, translator_wrapper, box_type, allocators_type> del_v(dst.m_root, dst.m_allocators);
- detail::rtree::apply_visitor(del_v, *dst.m_root);
- dst.m_root = 0;
+ detail::rtree::visitors::destroy<value_type, options_type, translator_wrapper, box_type, allocators_type>
+ del_v(dst.m_members.root, dst.m_members.allocators());
+ detail::rtree::apply_visitor(del_v, *dst.m_members.root);
+ dst.m_members.root = 0;
         }
 
- dst.m_root = copy_v.result;
- dst.m_values_count = src.m_values_count;
- dst.m_leafs_level = src.m_leafs_level;
+ dst.m_members.root = copy_v.result;
+ dst.m_members.values_count = src.m_members.values_count;
+ dst.m_members.leafs_level = src.m_members.leafs_level;
     }
 
     /*!
@@ -1035,9 +988,9 @@
     size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_<false> const& /*is_nearest*/) const
     {
         detail::rtree::visitors::spatial_query<value_type, options_type, translator_wrapper, box_type, allocators_type, Predicates, OutIter>
- find_v(m_translator, predicates, out_it);
+ find_v(m_members.translator(), predicates, out_it);
 
- detail::rtree::apply_visitor(find_v, *m_root);
+ detail::rtree::apply_visitor(find_v, *m_members.root);
 
         return find_v.found_count;
     }
@@ -1088,22 +1041,58 @@
             DistancesPredicates,
             Predicates,
             result_type
- > nearest_v(m_parameters, m_translator, dpred, pred, result);
+ > nearest_v(m_members.parameters(), m_members.translator(), dpred, pred, result);
 
- detail::rtree::apply_visitor(nearest_v, *m_root);
+ detail::rtree::apply_visitor(nearest_v, *m_members.root);
 
         return result.finish();
     }
 
- translator_wrapper m_translator;
- Parameters m_parameters;
- allocators_type m_allocators;
-
- size_type m_values_count;
- size_type m_leafs_level;
- node_pointer m_root;
+ struct members_holder
+ : public translator_wrapper
+ , public Parameters
+ , public allocators_type
+ {
+ private:
+ members_holder(members_holder const&);
+
+ public:
+ template <typename Transl, typename Alloc>
+ members_holder(Transl const& transl,
+ Parameters const& parameters,
+ BOOST_FWD_REF(Alloc) alloc)
+ : translator_wrapper(transl)
+ , Parameters(parameters)
+ , allocators_type(boost::forward<Alloc>(alloc))
+ , values_count(0)
+ , leafs_level(0)
+ , root(0)
+ {}
+
+ template <typename Transl>
+ members_holder(Transl const& transl = Translator(),
+ Parameters const& parameters = Parameters())
+ : translator_wrapper(transl)
+ , Parameters(parameters)
+ , allocators_type()
+ , values_count(0)
+ , leafs_level(0)
+ , root(0)
+ {}
+
+ translator_wrapper const& translator() const { return *this; }
+ translator_wrapper & translator() { return *this; }
+ Parameters const& parameters() const { return *this; }
+ Parameters & parameters() { return *this; }
+ allocators_type const& allocators() const { return *this; }
+ allocators_type & allocators() { return *this; }
+
+ size_type values_count;
+ size_type leafs_level;
+ node_pointer root;
+ };
 
- box_type m_box;
+ members_holder m_members;
 };
 
 /*!
@@ -1363,7 +1352,7 @@
 \return The box containing all stored values or an invalid box.
 */
 template <typename Value, typename Options, typename Translator, typename Allocator>
-inline typename rtree<Value, Options, Translator, Allocator>::bounds_type const&
+inline typename rtree<Value, Options, Translator, Allocator>::bounds_type
 bounds(rtree<Value, Options, Translator, Allocator> const& tree)
 {
     return tree.bounds();


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