mp_pop_back.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2015, 2019 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/algorithm.hpp>
  9. #include <boost/mp11/list.hpp>
  10. #include <boost/mp11/utility.hpp>
  11. #include <type_traits>
  12. #include <tuple>
  13. #include <utility>
  14. int main()
  15. {
  16. using boost::mp11::mp_list;
  17. using boost::mp11::mp_pop_back;
  18. using L1 = mp_list<void>;
  19. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L1>, mp_list<>>));
  20. using L2 = mp_list<float, void, int[]>;
  21. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L2>, mp_list<float, void>>));
  22. using L3 = std::tuple<int>;
  23. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L3>, std::tuple<>>));
  24. using L4 = std::tuple<char, double>;
  25. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L4>, std::tuple<char>>));
  26. using boost::mp11::mp_iota_c;
  27. using boost::mp11::mp_size_t;
  28. int const N = 137;
  29. using L6 = mp_iota_c<N>;
  30. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L6>, mp_iota_c<N-1>>));
  31. using boost::mp11::mp_valid;
  32. using L7 = mp_list<>;
  33. BOOST_TEST_TRAIT_FALSE((mp_valid<mp_pop_back, L7>));
  34. return boost::report_errors();
  35. }