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

Click here to view the latest version of this page.
PrevUpHomeNext
Boost.Range reversed

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

Description

Boost.Range reversed range adaptor reverses a range.

Model of

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

Header

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

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

Example

Shows how to use a Boost.Geometry linestring, reversed 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/reversed.hpp>

int main()
{
    typedef boost::geometry::model::d2::point_xy<int> xy;
    boost::geometry::model::linestring<xy> line;
    line.push_back(xy(0, 0));
    line.push_back(xy(1, 1));

    std::cout
        << boost::geometry::dsv(line | boost::adaptors::reversed)
        << std::endl;

    return 0;
}

Output:

((1, 1), (0, 0))

PrevUpHomeNext