decay.cpp 876 B

12345678910111213141516171819202122232425262728
  1. /*=============================================================================
  2. Copyright (c) 2017 Paul Fultz II
  3. decay.cpp
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #include <boost/hof/decay.hpp>
  8. #include "test.hpp"
  9. #define CHECK_DECAY(T) \
  10. STATIC_ASSERT_SAME(decltype(boost::hof::decay(std::declval<T>())), std::decay<T>::type)
  11. BOOST_HOF_TEST_CASE()
  12. {
  13. CHECK_DECAY(int);
  14. CHECK_DECAY(int*);
  15. CHECK_DECAY(int&);
  16. CHECK_DECAY(int&&);
  17. CHECK_DECAY(const int&);
  18. CHECK_DECAY(int[2]);
  19. CHECK_DECAY(int(int));
  20. }
  21. BOOST_HOF_TEST_CASE()
  22. {
  23. BOOST_HOF_TEST_CHECK(boost::hof::decay(3) == 3);
  24. BOOST_HOF_STATIC_TEST_CHECK(boost::hof::decay(3) == 3);
  25. }