Add a variadic mp_transform implementation

This commit is contained in:
Peter Dimov
2017-04-01 17:39:02 +03:00
parent e871f0c30c
commit fcbe835f4b
2 changed files with 50 additions and 2 deletions

View File

@@ -29,6 +29,15 @@ struct Z2 {};
struct Z3 {};
struct Z4 {};
struct U1 {};
struct U2 {};
struct V1 {};
struct V2 {};
struct W1 {};
struct W2 {};
template<class T> using add_pointer = typename std::add_pointer<T>::type;
template<class T, class U> using is_same = typename std::is_same<T, U>::type;
@@ -81,5 +90,16 @@ int main()
//
using L8 = std::pair<Z1, Z2>;
using L9 = std::pair<U1, U2>;
using L10 = std::pair<V1, V2>;
using L11 = std::pair<W1, W2>;
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform<std::tuple, L5, L6, L8, L9>, std::pair<std::tuple<X1, Y1, Z1, U1>, std::tuple<X2, Y2, Z2, U2>>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform<std::tuple, L5, L6, L8, L9, L10>, std::pair<std::tuple<X1, Y1, Z1, U1, V1>, std::tuple<X2, Y2, Z2, U2, V2>>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_transform<std::tuple, L5, L6, L8, L9, L10, L11>, std::pair<std::tuple<X1, Y1, Z1, U1, V1, W1>, std::tuple<X2, Y2, Z2, U2, V2, W2>>>));
//
return boost::report_errors();
}