diff options
author | Adrian Kummerlaender | 2015-02-14 10:43:49 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-14 10:43:49 +0100 |
commit | e24f25ada7e8f48dc35cb235e045a4324bccb4f2 (patch) | |
tree | 3b6c409c7d336557163dcb25e4b11fdef82a3a79 /example | |
parent | 73680466149c7aad21de558b7acc11dfa05183d2 (diff) | |
download | TypeAsValue-e24f25ada7e8f48dc35cb235e045a4324bccb4f2.tar TypeAsValue-e24f25ada7e8f48dc35cb235e045a4324bccb4f2.tar.gz TypeAsValue-e24f25ada7e8f48dc35cb235e045a4324bccb4f2.tar.bz2 TypeAsValue-e24f25ada7e8f48dc35cb235e045a4324bccb4f2.tar.lz TypeAsValue-e24f25ada7e8f48dc35cb235e045a4324bccb4f2.tar.xz TypeAsValue-e24f25ada7e8f48dc35cb235e045a4324bccb4f2.tar.zst TypeAsValue-e24f25ada7e8f48dc35cb235e045a4324bccb4f2.zip |
Introduced `Eval` function evaluation helper
* replaces `typename *::type` constructs with `Eval` applications
* aims to further unify function evaluation
Diffstat (limited to 'example')
-rw-r--r-- | example/prime/prime.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/example/prime/prime.cc b/example/prime/prime.cc index e89d2a4..b826a72 100644 --- a/example/prime/prime.cc +++ b/example/prime/prime.cc @@ -11,7 +11,7 @@ #include "runtime/list/for_each.h" // (define candidates (iota 1000 2 1)) -using candidates = tav::Iota<tav::Size<1000>, tav::Int<2>, tav::Int<1>>::type; +using candidates = tav::Eval<tav::Iota<tav::Size<1000>, tav::Int<2>, tav::Int<1>>>; // (define (isMultipleOf candidate base) (= (modulo candidate base) 0)) template < @@ -42,15 +42,15 @@ using removeMultiplesOf = tav::Remove< // (car candidates))))))) template <typename Candidates> struct Sieve { - typedef typename tav::Cons< + typedef tav::Eval<tav::Cons< tav::Head<Candidates>, - typename Sieve< - typename removeMultiplesOf< + tav::Eval<Sieve< + tav::Eval<removeMultiplesOf< tav::Tail<Candidates>, tav::Head<Candidates> - >::type - >::type - >::type type; + >> + >> + >> type; }; template <> @@ -59,7 +59,7 @@ struct Sieve<void> { }; // (define primes (sieve candidates)) -using primes = Sieve<candidates>::type; +using primes = tav::Eval<Sieve<candidates>>; int main(int, char **) { tav::runtime::for_each<primes>([](const int x) { |