Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit fed4359bab.
PrevUpHomeNext
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:

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>

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))

PrevUpHomeNext