static_assert.hpp 974 B

123456789101112131415161718192021222324252627282930313233
  1. // Boost.Geometry
  2. // Copyright (c) 2020, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_CORE_STATIC_ASSERT_HPP
  7. #define BOOST_GEOMETRY_CORE_STATIC_ASSERT_HPP
  8. #include <type_traits>
  9. #include <boost/static_assert.hpp>
  10. namespace boost { namespace geometry { namespace detail
  11. {
  12. template <bool Check, typename ...Ts>
  13. struct static_assert_check : std::integral_constant<bool, Check> {};
  14. #define BOOST_GEOMETRY_STATIC_ASSERT(CHECK, MESSAGE, ...) \
  15. static_assert(boost::geometry::detail::static_assert_check<(CHECK), __VA_ARGS__>::value, MESSAGE)
  16. #define BOOST_GEOMETRY_STATIC_ASSERT_FALSE(MESSAGE, ...) \
  17. static_assert(boost::geometry::detail::static_assert_check<false, __VA_ARGS__>::value, MESSAGE)
  18. }}} // namespace boost::geometry::detail
  19. #endif // BOOST_GEOMETRY_CORE_STATIC_ASSERT_HPP