Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / geometry / doc / src / examples / geometries / adapted / boost_range / reversed.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // QuickBook Example
3
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 //[boost_range_reversed
11 //` Shows how to use a Boost.Geometry linestring, reversed by Boost.Range adaptor
12
13 #include <iostream>
14
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/linestring.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
18 #include <boost/geometry/geometries/adapted/boost_range/reversed.hpp>
19
20 int main()
21 {
22     typedef boost::geometry::model::d2::point_xy<int> xy;
23     boost::geometry::model::linestring<xy> line;
24     line.push_back(xy(0, 0));
25     line.push_back(xy(1, 1));
26
27     std::cout
28         << boost::geometry::dsv(line | boost::adaptors::reversed)
29         << std::endl;
30
31     return 0;
32 }
33
34 //]
35
36 //[boost_range_reversed_output
37 /*`
38 Output:
39 [pre
40 ((1, 1), (0, 0))
41 ]
42 */
43 //]