...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Boost.Range sliced range adaptor is adapted to Boost.Geometry
Boost.Range sliced range adaptor creates a slice of a range (usually a linestring)
The Boost.Range sliced range adaptor takes over the model of the original geometry, which might be:
#include <boost/geometry/geometries/adapted/boost_range/sliced.hpp>
The standard header boost/geometry.hpp
does not include this header.
Shows how to use a Boost.Geometry linestring, sliced by Boost.Range adaptor
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/linestring.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/adapted/boost_range/sliced.hpp> #include <boost/assign.hpp> int main() { using namespace boost::assign; typedef boost::geometry::model::d2::point_xy<int> xy; boost::geometry::model::linestring<xy> line; line += xy(0, 0); line += xy(1, 1); line += xy(2, 2); line += xy(3, 3); line += xy(4, 4); std::cout << boost::geometry::dsv(line | boost::adaptors::sliced(1, 3)) << std::endl; return 0; }
Output:
((1, 1), (2, 2))