mp_pop_front.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 <type_traits>
  10. #include <tuple>
  11. #include <utility>
  12. int main()
  13. {
  14. using boost::mp11::mp_list;
  15. using boost::mp11::mp_pop_front;
  16. using boost::mp11::mp_rest;
  17. using L1 = mp_list<void>;
  18. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_front<L1>, mp_list<>>));
  19. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rest<L1>, mp_list<>>));
  20. using L2 = mp_list<int[], void(), float>;
  21. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_front<L2>, mp_list<void(), float>>));
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rest<L2>, mp_list<void(), float>>));
  23. using L3 = std::tuple<int>;
  24. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_front<L3>, std::tuple<>>));
  25. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rest<L3>, std::tuple<>>));
  26. using L4 = std::tuple<char, double>;
  27. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_front<L4>, std::tuple<double>>));
  28. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_rest<L4>, std::tuple<double>>));
  29. return boost::report_errors();
  30. }