check.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  3. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // This file was modified by Oracle on 2020-2021.
  6. // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  9. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  10. // Use, modification and distribution is subject to the Boost Software License,
  11. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
  14. #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
  15. #include <boost/concept_check.hpp>
  16. #include <boost/concept/requires.hpp>
  17. #include <boost/geometry/algorithms/detail/select_geometry_type.hpp>
  18. #include <boost/geometry/geometries/concepts/concept_type.hpp>
  19. #include <boost/geometry/geometries/concepts/box_concept.hpp>
  20. #include <boost/geometry/geometries/concepts/dynamic_geometry_concept.hpp>
  21. #include <boost/geometry/geometries/concepts/geometry_collection_concept.hpp>
  22. #include <boost/geometry/geometries/concepts/linestring_concept.hpp>
  23. #include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
  24. #include <boost/geometry/geometries/concepts/multi_linestring_concept.hpp>
  25. #include <boost/geometry/geometries/concepts/multi_polygon_concept.hpp>
  26. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  27. #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
  28. #include <boost/geometry/geometries/concepts/ring_concept.hpp>
  29. #include <boost/geometry/geometries/concepts/segment_concept.hpp>
  30. namespace boost { namespace geometry { namespace concepts
  31. {
  32. /*!
  33. \brief Checks, in compile-time, the concept of any geometry
  34. \ingroup concepts
  35. */
  36. template <typename Geometry>
  37. // workaround for VS2015
  38. #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
  39. constexpr
  40. #endif
  41. inline void check()
  42. {
  43. BOOST_CONCEPT_ASSERT((typename concept_type<Geometry>::type));
  44. }
  45. /*!
  46. \brief Checks, in compile-time, the concept of two geometries, and if they
  47. have equal dimensions
  48. \ingroup concepts
  49. */
  50. template <typename Geometry1, typename Geometry2>
  51. // workaround for VS2015
  52. #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
  53. constexpr
  54. #endif
  55. inline void check_concepts_and_equal_dimensions()
  56. {
  57. check<Geometry1>();
  58. check<Geometry2>();
  59. assert_dimension_equal
  60. <
  61. typename geometry::detail::first_geometry_type<Geometry1>::type,
  62. typename geometry::detail::first_geometry_type<Geometry2>::type
  63. >();
  64. }
  65. }}} // namespace boost::geometry::concepts
  66. #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP