test.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. Copyright Barrett Adair 2016-2017
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)
  5. */
  6. #include <type_traits>
  7. #include <functional>
  8. #include <tuple>
  9. #include <utility>
  10. #include <boost/callable_traits.hpp>
  11. using namespace boost::callable_traits;
  12. #ifndef CT_ASSERT
  13. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
  14. #endif //CT_ASSERT
  15. #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
  16. #define LREF
  17. #define RREF
  18. #else
  19. #define LREF &
  20. #define RREF &&
  21. #endif
  22. #define TX_SAFE BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER
  23. #define VA_CC BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
  24. #ifndef PP_CAT
  25. #define PP_CAT_(x, y) x ## y
  26. #define PP_CAT(x, y) PP_CAT_(x, y)
  27. #endif
  28. #ifdef USE_LAZY_TYPES
  29. #define TRAIT(trait, ...) typename trait<__VA_ARGS__>::type
  30. #else
  31. #define TRAIT(trait, ...) PP_CAT(trait, _t)<__VA_ARGS__>
  32. #endif
  33. #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
  34. #define TEST_NOEXCEPT_QUAL noexcept
  35. #else
  36. #define TEST_NOEXCEPT_QUAL
  37. #endif
  38. #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  39. #define TEST_ABOM_V
  40. #else
  41. #define TEST_ABOM_V volatile
  42. #endif
  43. template<typename T1, typename T2>
  44. void assert_same() {
  45. CT_ASSERT(std::is_same<T1, T2>::value);
  46. }