
Hi, On 09/11/13 22:26, klaus triendl wrote:
Nevertheless I'd like to propose a new metafunction that simply evaluates its argument:
template<typename F> struct eval: F::type {};
I've found it somehow useful because it avoids syntactical sugar when specifying a condition to be evaluated for eval_if:
eval_if< eval
>, F1, F2 >; instead of writing:
eval_if< typename apply
::type, F1, F2 >; Any comments on this?
"apply
::type
The "lazy<...>" template takes its argument (a metaprogram) and evaluates every argument of every metafunction call in it. Since eval_if is a special metafunction (its second and third arguments are lazy), it needs the extra lazy_argument templates as well. You can read about it and laziness in metaprograms in the Metamonad user manual (http://abel.web.elte.hu/mpllibs/metamonad/manual.html#lazy-metafunctions) I gave a talk at C++Now this year about Metamonad and the first part of the talk covered laziness in metaprograms. You can watch it here: http://www.youtube.com/watch?v=aIj034VCUD8 Regards, Ábel