Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-09-20 06:46:08


>From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>

>Terje Slettebø wrote:
>> Consider the "factorial" metafunction, again:
>>
>> template<class V>
>> struct factorial
>> {
>> typedef typename V::type Value;
>>
>> typedef typename apply_if<equal_to<Value,value<Value,0> >,
>> value<Value,1>,
>> mul<Value,factorial<prior<Value> > >
>> >::type type;
>> }
>
>Here's how you could write it with lazy-lambda:

<snip>

>It even works :).

Yes. I saw the posting from Richard a little earlier, that had in fact the
same kind of proposal (using "eva" or "eval"), and I see that that one does
indeed work, as well.

Ok, I understand that this issue can be solved in the way MPL is designed.
I'm also glad that when I and Jaap brought up this issue, it was
acknowledged to be a real problem. :)

Regards,

Terje


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk