// Copyright 2019 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt #include #include #include #include using boost::mp11::mp_int; template using mod_2 = mp_int; template using mod_3 = mp_int; template using mod_6 = mp_int; using boost::mp11::mp_not; using boost::mp11::mp_plus; template using P1 = mp_not>; template using P2 = mp_not>; using boost::mp11::mp_bool; template struct second_is { template using fn = mp_bool< T2::value == N >; }; using boost::mp11::mp_first; using boost::mp11::mp_filter_q; using boost::mp11::mp_iota; using boost::mp11::mp_size; template using at_c = mp_first< mp_filter_q< second_is, L, mp_iota> > >; int main() { using boost::mp11::mp_iota_c; using boost::mp11::mp_filter; using boost::mp11::mp_list; using boost::mp11::mp_size_t; using boost::mp11::mp_transform; { int const N = 12; using L1 = mp_iota_c; using R1 = mp_filter; BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<6>>>)); using L2 = mp_transform; using L3 = mp_transform; using L6 = mp_transform; using R2 = mp_filter; BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<6>>>)); using R3 = mp_filter; BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<6>>>)); } { int const N = 64; int const M = 17; using L1 = mp_iota_c; using R1 = at_c; BOOST_TEST_TRAIT_TRUE((std::is_same>)); } return boost::report_errors(); }