Re: [Boost-bugs] [Boost C++ Libraries] #10615: R-Tree: add constructor that converts any range<T> to the trees value type

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10615: R-Tree: add constructor that converts any range<T> to the trees value type
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-10-06 21:38:17


#10615: R-Tree: add constructor that converts any range<T> to the trees value type
-------------------------------+---------------------------
  Reporter: anonymous | Owner: barendgehrels
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: geometry
   Version: Boost 1.56.0 | Severity: Optimization
Resolution: | Keywords:
-------------------------------+---------------------------

Comment (by anonymous):

 So again, thank you and consider this solved. After I found time to
 actually read the Boost.Range documentation and not just wildly try stuff
 out it was easy to adapt my code and remove the additional copying of the
 container of points. For future reference I'll post a more complete
 solution, since it was not immediately obvious to me that I needed to
 create a good old functor instead of a lambda.

 {{{
 #!div style="font-size: 80%"
   {{{#!c++
 class my_point; //a point type known to Boost.Geometry
 typedef std::vector<my_point> point_list;
 typedef std::pair<my_point, point_list::size_type> indexed_point;

 struct add_index
 {
     typedef indexed_point result_type;
     template<typename T>
     inline result_type operator()(const T &v) const
     {
         return std::make_pair(v.value(), v.index());
     }
 };

 point_list p; //fill with points
 rtree<indexed_point, /*Parameters*/> rt1(p | boost::adaptors::indexed()
                                            |
 boost::adaptors::transformed(add_index()));

   }}}
 }}}

 Thanks again for your hint and sorry for the noise in here.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10615#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC