mpl_list.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2017, 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/mp11/mpl_list.hpp>
  8. #include <boost/mp11/list.hpp>
  9. #include <boost/mpl/at.hpp>
  10. #include <boost/mpl/size.hpp>
  11. #include <boost/core/lightweight_test_trait.hpp>
  12. int main()
  13. {
  14. namespace mpl = boost::mpl;
  15. using namespace boost::mp11;
  16. using L1 = mp_list<void, int, float>;
  17. BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at<L1, mpl::int_<0>>::type, mp_at_c<L1, 0>>));
  18. BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at<L1, mpl::int_<1>>::type, mp_at_c<L1, 1>>));
  19. BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at<L1, mpl::int_<2>>::type, mp_at_c<L1, 2>>));
  20. BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at_c<L1, 0>::type, mp_at_c<L1, 0>>));
  21. BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at_c<L1, 1>::type, mp_at_c<L1, 1>>));
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at_c<L1, 2>::type, mp_at_c<L1, 2>>));
  23. BOOST_TEST_EQ((mpl::size<L1>::type::value), mp_size<L1>::value);
  24. return boost::report_errors();
  25. }