/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. // Copyright (c) 2011 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Use, modification and distribution is subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //[boost_range_reversed
  8. //` Shows how to use a Boost.Geometry linestring, reversed by Boost.Range adaptor
  9. #include <iostream>
  10. #include <boost/geometry.hpp>
  11. #include <boost/geometry/geometries/linestring.hpp>
  12. #include <boost/geometry/geometries/point_xy.hpp>
  13. #include <boost/geometry/geometries/adapted/boost_range/reversed.hpp>
  14. int main()
  15. {
  16. typedef boost::geometry::model::d2::point_xy<int> xy;
  17. boost::geometry::model::linestring<xy> line;
  18. line.push_back(xy(0, 0));
  19. line.push_back(xy(1, 1));
  20. std::cout
  21. << boost::geometry::dsv(line | boost::adaptors::reversed)
  22. << std::endl;
  23. return 0;
  24. }
  25. //]
  26. //[boost_range_reversed_output
  27. /*`
  28. Output:
  29. [pre
  30. ((1, 1), (0, 0))
  31. ]
  32. */
  33. //]