is_noexcept.cpp 927 B

123456789101112131415161718192021222324252627282930313233
  1. /*<-
  2. Copyright (c) 2016 Barrett Adair
  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 <boost/callable_traits/detail/config.hpp>
  7. #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
  8. int main(){}
  9. #else
  10. //[ is_noexcept
  11. #include <boost/callable_traits/is_noexcept.hpp>
  12. namespace ct = boost::callable_traits;
  13. struct foo;
  14. static_assert(ct::is_noexcept<int() noexcept>::value, "");
  15. static_assert(ct::is_noexcept<int(*)() noexcept>::value, "");
  16. static_assert(ct::is_noexcept<int(&)() noexcept>::value, "");
  17. static_assert(ct::is_noexcept<int(foo::*)() const noexcept>::value, "");
  18. static_assert(!ct::is_noexcept<int()>::value, "");
  19. static_assert(!ct::is_noexcept<int(*)()>::value, "");
  20. static_assert(!ct::is_noexcept<int(&)()>::value, "");
  21. static_assert(!ct::is_noexcept<int(foo::*)() const>::value, "");
  22. int main() {}
  23. //]
  24. #endif