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

http://hadesmem.googlecode.com/ · C++ · 38 lines · 11 code · 10 blank · 17 comment · 0 complexity · cef238d4570f001a083d716a74515dbb 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. //[c_array
  8. //` Small example showing the combination of an array with a Boost.Geometry algorithm
  9. #include <iostream>
  10. #include <boost/geometry.hpp>
  11. #include <boost/geometry/geometries/adapted/c_array.hpp>
  12. BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
  13. int main()
  14. {
  15. int a[3] = {1, 2, 3};
  16. int b[3] = {2, 3, 4};
  17. std::cout << boost::geometry::distance(a, b) << std::endl;
  18. return 0;
  19. }
  20. //]
  21. //[c_array_output
  22. /*`
  23. Output:
  24. [pre
  25. 1.73205
  26. ]
  27. */
  28. //]