From 7ce93ff513a993b8b46fbb401b232d6f557b948b Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 26 Jan 2015 18:54:59 +0100 Subject: Added pair and triple aliae for the variadic `Apply` type --- src/function/apply.h | 12 +++++++++--- test.cc | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/function/apply.h b/src/function/apply.h index d353169..6012a01 100644 --- a/src/function/apply.h +++ b/src/function/apply.h @@ -48,15 +48,21 @@ struct Apply { typedef typename tav::List::type argument_list; template - using type = Function< + using variadic_type = Function< typename detail::resolve_placeholder< typename tav::List::type, Arguments >::type... >; - template - using single_type = type; + template + using single_type = variadic_type; + + template + using pair_type = variadic_type; + + template + using triple_type = variadic_type; }; } diff --git a/test.cc b/test.cc index 6f95ca9..0c16126 100644 --- a/test.cc +++ b/test.cc @@ -639,7 +639,13 @@ static_assert( static_assert( std::is_same< tav::Int<42>, - tav::Apply, tav::_0>::type>::type + tav::Apply< + tav::Multiply, + tav::Int<21>, + tav::_0 + >::single_type< + tav::Int<2> + >::type >::value, "((lambda (x) (* 21 x)) 2) != 42" ); @@ -648,7 +654,11 @@ static_assert( std::is_same< tav::List, tav::Int<12>, tav::Int<14>>::type, tav::Map< - tav::Apply>::single_type, + tav::Apply< + tav::Add, + tav::_0, + tav::Int<10> + >::single_type, tav::List, tav::Int<2>, tav::Int<4>>::type >::type >::value, -- cgit v1.2.3