On 3/12/2015 1:47 PM, pfultz2 wrote:
I never need to use helper metafunctions. Meta's expression evaluator handles laziness.
Yes you do use helper metafunctions. Look at your implementation of fold.
You have a point. There are lots of dirty tricks in the implementation of Meta to work around language shortcomings and improve compile-times. That's not generally how Meta is *used*, but when I said "never" I was being too strong.
With a library built with full laziness, you should be able to build a SFINAE- friendly fold like this:
template
using fold = eval_if , Fun> ;
Template aliases cannot be self-referential. The alias isn't in scope until the semicolon. It's a bit of a bummer.
Is something like this possible with Meta library?
Sadly not, at least not right now. For some things, like recursion and
specialization, there's no escaping class templates, and hence
metafunctions. That's OK, Meta works fine with metafunctions; just use
meta::lazy as if it were the MPL. The inconsistency bugs me though.
I'd very much like to add support for recursive lambdas. I can imagine
the factorial example looking like this:
using factorial_ = lambda_rec<_a,
lazy::if_c