static_assert.hpp 1.2 KB

123456789101112131415161718192021222324252627282930
  1. // static_assert.hpp --------------------------------------------------------------//
  2. // Copyright 2009-2010 Vicente J. Botet Escriba
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // See http://www.boost.org/LICENSE_1_0.txt
  5. #ifndef BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP
  6. #define BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP
  7. #include <boost/chrono/config.hpp>
  8. #ifndef BOOST_NO_CXX11_STATIC_ASSERT
  9. #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
  10. #elif defined(BOOST_CHRONO_USES_STATIC_ASSERT)
  11. #include <boost/static_assert.hpp>
  12. #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
  13. #elif defined(BOOST_CHRONO_USES_MPL_ASSERT)
  14. #include <boost/mpl/assert.hpp>
  15. #include <boost/mpl/bool.hpp>
  16. #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) \
  17. BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
  18. #else
  19. //~ #elif defined(BOOST_CHRONO_USES_ARRAY_ASSERT)
  20. #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_JOIN(boost_chrono_test_,__LINE__)[(CND)?1:-1]
  21. //~ #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES)
  22. #endif
  23. #endif // BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP