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