// Copyright 2020 Peter Dimov. // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #include struct X1 {}; struct X2 { using first_type = double; using next_type = X1; }; struct X3 { using first_type = float; using next_type = X2; }; struct X4 { using first_type = int; using next_type = X3; }; template using first_type = typename T::first_type; template using next_type = typename T::next_type; template struct cons {}; template struct cons2 { using first_type = T1; using next_type = T2; }; using boost::mp11::mp_reverse_fold; using boost::mp11::mp_iterate; using boost::mp11::mp_first; using boost::mp11::mp_second; using boost::mp11::mp_rest; template void test() { using R1 = mp_iterate; BOOST_TEST_TRAIT_TRUE((std::is_same)); using V2 = mp_reverse_fold; using R2 = mp_iterate; BOOST_TEST_TRAIT_TRUE((std::is_same)); #if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) using V3 = mp_reverse_fold; using R3 = mp_iterate; BOOST_TEST_TRAIT_TRUE((std::is_same)); #endif } int main() { using boost::mp11::mp_list; test< mp_list<> >(); test< mp_list >(); test< mp_list >(); test< mp_list >(); test< mp_list >(); using boost::mp11::mp_identity_t; BOOST_TEST_TRAIT_TRUE((std::is_same, mp_list>)); BOOST_TEST_TRAIT_TRUE((std::is_same, mp_list>)); return boost::report_errors(); }