aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-01-26 18:54:59 +0100
committerAdrian Kummerlaender2015-01-26 18:54:59 +0100
commit7ce93ff513a993b8b46fbb401b232d6f557b948b (patch)
tree989a9c5bfb7d6c91fb6821bc0dcc0cead9d49d2c
parent8b6de4c8c89d31c5d0e16548767ef21f242aadd1 (diff)
downloadTypeAsValue-7ce93ff513a993b8b46fbb401b232d6f557b948b.tar
TypeAsValue-7ce93ff513a993b8b46fbb401b232d6f557b948b.tar.gz
TypeAsValue-7ce93ff513a993b8b46fbb401b232d6f557b948b.tar.bz2
TypeAsValue-7ce93ff513a993b8b46fbb401b232d6f557b948b.tar.lz
TypeAsValue-7ce93ff513a993b8b46fbb401b232d6f557b948b.tar.xz
TypeAsValue-7ce93ff513a993b8b46fbb401b232d6f557b948b.tar.zst
TypeAsValue-7ce93ff513a993b8b46fbb401b232d6f557b948b.zip
Added pair and triple aliae for the variadic `Apply` type
-rw-r--r--src/function/apply.h12
-rw-r--r--test.cc14
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<Arguments...>::type argument_list;
template <typename... Partials>
- using type = Function<
+ using variadic_type = Function<
typename detail::resolve_placeholder<
typename tav::List<Partials...>::type,
Arguments
>::type...
>;
- template <typename Partials>
- using single_type = type<Partials>;
+ template <typename Partial>
+ using single_type = variadic_type<Partial>;
+
+ template <typename Partial0, typename Partial1>
+ using pair_type = variadic_type<Partial0, Partial1>;
+
+ template <typename Partial0, typename Partial1, typename Partial2>
+ using triple_type = variadic_type<Partial0, Partial1, Partial2>;
};
}
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::Multiply, tav::Int<21>, tav::_0>::type<tav::Int<2>>::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<10>, tav::Int<12>, tav::Int<14>>::type,
tav::Map<
- tav::Apply<tav::Add, tav::_0, tav::Int<10>>::single_type,
+ tav::Apply<
+ tav::Add,
+ tav::_0,
+ tav::Int<10>
+ >::single_type,
tav::List<tav::Int<0>, tav::Int<2>, tav::Int<4>>::type
>::type
>::value,