mp_front.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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_front;
  16. using boost::mp11::mp_first;
  17. using L1 = mp_list<void>;
  18. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_front<L1>, void>));
  19. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_first<L1>, void>));
  20. using L2 = mp_list<int[], void, float>;
  21. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_front<L2>, int[]>));
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_first<L2>, int[]>));
  23. using L3 = std::tuple<int>;
  24. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_front<L3>, int>));
  25. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_first<L3>, int>));
  26. using L4 = std::pair<char, double>;
  27. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_front<L4>, char>));
  28. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_first<L4>, char>));
  29. using L5 = std::add_const<void()>;
  30. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_front<L5>, void()>));
  31. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_first<L5>, void()>));
  32. return boost::report_errors();
  33. }