check.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #include <boost/geometry/geometries/concepts/polyhedral_surface_concept.hpp>
  31. namespace boost { namespace geometry { namespace concepts
  32. {
  33. /*!
  34. \brief Checks, in compile-time, the concept of any geometry
  35. \ingroup concepts
  36. */
  37. template <typename Geometry>
  38. // workaround for VS2015
  39. #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
  40. constexpr
  41. #endif
  42. inline void check()
  43. {
  44. BOOST_CONCEPT_ASSERT((typename concept_type<Geometry>::type));
  45. }
  46. /*!
  47. \brief Checks, in compile-time, the concept of two geometries, and if they
  48. have equal dimensions
  49. \ingroup concepts
  50. */
  51. template <typename Geometry1, typename Geometry2>
  52. // workaround for VS2015
  53. #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
  54. constexpr
  55. #endif
  56. inline void check_concepts_and_equal_dimensions()
  57. {
  58. check<Geometry1>();
  59. check<Geometry2>();
  60. assert_dimension_equal
  61. <
  62. typename geometry::detail::first_geometry_type<Geometry1>::type,
  63. typename geometry::detail::first_geometry_type<Geometry2>::type
  64. >();
  65. }
  66. }}} // namespace boost::geometry::concepts
  67. #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP