| Home | Libraries | People | FAQ | More

##### Boost.Range sliced

Boost.Range sliced range adaptor is adapted to Boost.Geometry

###### Description

Boost.Range sliced range adaptor creates a slice of a range (usually a linestring)

###### Model of

The Boost.Range sliced range adaptor takes over the model of the original geometry, which might be:

- a linestring
- a ring
- a multi_point
- a multi_linestring
- a multi_polygon

###### Header

`#include <boost/geometry/geometries/adapted/boost_range/sliced.hpp>`

The standard header `boost/geometry.hpp` does not include this header.

###### Example

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;
    }

| At the end to avoid conflicts with Boost.QVM

Output:

    ((1, 1), (2, 2))