...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> int main() { using xy = boost::geometry::model::d2::point_xy<int>; boost::geometry::model::linestring<xy> line = {{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}}; std::cout << boost::geometry::dsv(line | boost::adaptors::sliced(1, 3)) << std::endl; return 0; }
Output:
((1, 1), (2, 2))