PageRenderTime 34ms CodeModel.GetById 29ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/Src/Dependencies/Boost/libs/geometry/doc/src/examples/geometries/adapted/boost_range/reversed.cpp

http://hadesmem.googlecode.com/
C++ | 43 lines | 16 code | 10 blank | 17 comment | 0 complexity | 9cbe801439bf15cd3a9f245fe8bd1679 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// QuickBook Example
 3
 4// Copyright (c) 2011 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
20int 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/*`
38Output:
39[pre
40((1, 1), (0, 0))
41]
42*/
43//]