is_implemented.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Unit Test
  3. // Copyright (c) 2014 Samuel Debionne, Grenoble, France.
  4. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  5. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  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. #include <geometry_test_common.hpp>
  10. #include <boost/geometry/core/reverse_dispatch.hpp>
  11. #include <boost/geometry/core/tag_cast.hpp>
  12. #include <boost/geometry/geometries/point_xy.hpp>
  13. #include <boost/geometry/strategies/tags.hpp>
  14. #include <boost/geometry/algorithms/not_implemented.hpp>
  15. #include <boost/geometry/util/is_implemented.hpp>
  16. #include <boost/type_traits/is_same.hpp>
  17. #include <boost/mpl/assert.hpp>
  18. #include <boost/mpl/bool.hpp>
  19. namespace boost { namespace geometry
  20. {
  21. namespace strategy { namespace services
  22. {
  23. template <typename Strategy> struct tag
  24. {
  25. typedef not_implemented type;
  26. };
  27. }} // namespace strategy::services
  28. template
  29. <
  30. typename Geometry1, typename Geometry2,
  31. typename Strategy,
  32. typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
  33. typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
  34. typename StrategyTag = typename strategy::services::tag<Strategy>::type,
  35. bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
  36. >
  37. struct algorithm_archetype
  38. : not_implemented<>
  39. {};
  40. struct strategy_archetype
  41. {
  42. template <typename Geometry1, typename Geometry2>
  43. static void apply(Geometry1, Geometry2) {}
  44. };
  45. }} // namespace boost::geometry
  46. int test_main(int, char* [])
  47. {
  48. typedef bg::model::d2::point_xy<double> point_type;
  49. BOOST_MPL_ASSERT((
  50. boost::is_same<
  51. bg::util::is_implemented2
  52. <
  53. point_type, point_type,
  54. bg::algorithm_archetype<point_type, point_type, bg::strategy_archetype>
  55. >::type,
  56. boost::mpl::false_
  57. >
  58. ));
  59. return 0;
  60. }