Make mp_transform_if variadic.

This commit is contained in:
Peter Dimov
2017-03-18 19:48:07 +02:00
parent e1edd90c21
commit 8e053269a8
2 changed files with 63 additions and 4 deletions

View File

@@ -23,12 +23,18 @@ struct X4 {};
using boost::mp11::mp_not;
template<class T> using add_pointer = T*;
template<class T> using is_not_ref = mp_not<std::is_reference<T>>;
template<class T, class...> using is_not_ref = mp_not<std::is_reference<T>>;
template<class T1, class T2> using second = T2;
template<class T1, class T2, class T3> using third = T3;
int main()
{
using boost::mp11::mp_list;
using boost::mp11::mp_transform_if;
using boost::mp11::mp_size_t;
using boost::mp11::mp_size;
using boost::mp11::mp_fill;
using boost::mp11::mp_iota;
using L1 = mp_list<X1, X2&, X3 const, X4 const&>;
@@ -44,5 +50,15 @@ int main()
//
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform_if<is_not_ref, second, L1, mp_fill<L1, void>>, mp_list<void, X2&, void, X4 const&>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform_if<is_not_ref, second, L2, mp_fill<L2, void>>, std::tuple<void, X2&, void, X4 const&>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform_if<is_not_ref, second, L3, mp_fill<L3, void>>, std::pair<void, X2&>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform_if<is_not_ref, third, L1, L1, mp_iota<mp_size<L1>>>, mp_list<mp_size_t<0>, X2&, mp_size_t<2>, X4 const&>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform_if<is_not_ref, third, L2, L2, mp_iota<mp_size<L2>>>, std::tuple<mp_size_t<0>, X2&, mp_size_t<2>, X4 const&>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform_if<is_not_ref, third, L3, L3, mp_iota<mp_size<L3>>>, std::pair<mp_size_t<0>, X2&>>));
//
return boost::report_errors();
}