// 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 #include #include struct X1 {}; struct X2 {}; struct X3 {}; template struct F {}; struct Q { template struct fn {}; }; int main() { using boost::mp11::mp_partial_sum; using boost::mp11::mp_list; using boost::mp11::mp_list_c; using boost::mp11::mp_int; using boost::mp11::mp_size_t; using boost::mp11::mp_plus; using boost::mp11::mp_rename; using boost::mp11::mp_partial_sum_q; using boost::mp11::mp_quote; { BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_list<>, void, F >, mp_list<> >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_list, void, F >, mp_list< F > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_list, void, F >, mp_list< F, F, X2> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_list, void, F >, mp_list< F, F, X2>, F, X2>, X3> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_list_c, mp_int<0>, mp_plus >, mp_list< mp_int<7>, mp_int<14>, mp_int<16> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_list_c, mp_size_t<0>, mp_plus >, mp_list< mp_size_t<7>, mp_size_t<14>, mp_size_t<16> > >)); } { BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list<>, void, mp_quote >, mp_list<> >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list, void, mp_quote >, mp_list< F > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list, void, mp_quote >, mp_list< F, F, X2> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list, void, mp_quote >, mp_list< F, F, X2>, F, X2>, X3> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list<>, void, Q >, mp_list<> >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list, void, Q >, mp_list< Q::fn > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list, void, Q >, mp_list< Q::fn, Q::fn, X2> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list, void, Q >, mp_list< Q::fn, Q::fn, X2>, Q::fn, X2>, X3> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list_c, mp_int<0>, mp_quote >, mp_list< mp_int<7>, mp_int<14>, mp_int<16> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_list_c, mp_size_t<0>, mp_quote >, mp_list< mp_size_t<7>, mp_size_t<14>, mp_size_t<16> > >)); } { BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< std::tuple<>, void, F >, std::tuple<> >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< std::tuple, void, F >, std::tuple< F > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< std::tuple, void, F >, std::tuple< F, F, X2> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< std::tuple, void, F >, std::tuple< F, F, X2>, F, X2>, X3> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_rename, std::tuple>, mp_int<0>, mp_plus >, std::tuple< mp_int<7>, mp_int<14>, mp_int<16> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum< mp_rename, std::tuple>, mp_size_t<0>, mp_plus >, std::tuple< mp_size_t<7>, mp_size_t<14>, mp_size_t<16> > >)); } { BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple<>, void, mp_quote >, std::tuple<> >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple, void, mp_quote >, std::tuple< F > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple, void, mp_quote >, std::tuple< F, F, X2> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple, void, mp_quote >, std::tuple< F, F, X2>, F, X2>, X3> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple<>, void, Q >, std::tuple<> >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple, void, Q >, std::tuple< Q::fn > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple, void, Q >, std::tuple< Q::fn, Q::fn, X2> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< std::tuple, void, Q >, std::tuple< Q::fn, Q::fn, X2>, Q::fn, X2>, X3> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_rename, std::tuple>, mp_int<0>, mp_quote >, std::tuple< mp_int<7>, mp_int<14>, mp_int<16> > >)); BOOST_TEST_TRAIT_TRUE((std::is_same< mp_partial_sum_q< mp_rename, std::tuple>, mp_size_t<0>, mp_quote >, std::tuple< mp_size_t<7>, mp_size_t<14>, mp_size_t<16> > >)); } return boost::report_errors(); }