mp_empty.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2015 Peter Dimov.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. //
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. #include <boost/core/lightweight_test_trait.hpp>
  8. #include <boost/mp11/list.hpp>
  9. #include <boost/mp11/integral.hpp>
  10. #include <type_traits>
  11. #include <tuple>
  12. #include <utility>
  13. int main()
  14. {
  15. using boost::mp11::mp_list;
  16. using boost::mp11::mp_empty;
  17. using boost::mp11::mp_true;
  18. using boost::mp11::mp_false;
  19. using L1 = mp_list<>;
  20. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L1>, mp_true>));
  21. using L2 = mp_list<void>;
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L2>, mp_false>));
  23. using L3 = mp_list<int[], void, float>;
  24. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L3>, mp_false>));
  25. using L4 = std::tuple<>;
  26. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L4>, mp_true>));
  27. using L5 = std::tuple<int>;
  28. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L5>, mp_false>));
  29. using L6 = std::tuple<int, int>;
  30. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L6>, mp_false>));
  31. using L7 = std::pair<char, double>;
  32. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L7>, mp_false>));
  33. using L8 = std::add_const<void()>;
  34. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_empty<L8>, mp_false>));
  35. return boost::report_errors();
  36. }