Boost logo

Boost :

From: Dirk Gerrits (dirk_at_[hidden])
Date: 2002-09-20 17:17:35


Terje Slettebø wrote:
>>From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>
>
>>Terje Slettebø wrote:
>>In the posting with my "factorial" metafunction
>>(http://aspn.activestate.com/ASPN/Mail/Message/1316005), I
>>propose to make the metafunctions evaluate their own arguments
>>(apply "::type" to them), just like it happens in run-time functions.
>>With that, the factorial example becomes (quoting from my posting):
>>
>>
>>>"value" is another new metafunction. It's a way to provide a generic
>>>constant, of the type given in the first argument, and the
>>>value given in the second. Thus, if "Value" is int_c<...>, then
>>>"value<Value,1>::type" is int_c<1>.
>>
>>mpl::integral_c<..>?
>
> I understand you haven't had a chance to read the post-review postings, as
> you say below here, because in the one where I introduced "value," I
> explained that it was a way to provide a generic constant, so that a
> metafunction could use any value type (integral_c, int_c, rational_c,
> fixed_c, etc.), rather than having to write one for each, and it still
> wouldn't work for any new type.
>
> It works like this: If Type is e.g. integral_c<...>, then
> "value<Type,0>::type" gives integral_c<0>. If Type is rational_c, then it
> gives rational_c<0,1>, etc.

Please forgive the insolence of a MPL newbie, but I thought integral_c
did exactly what your value is supposed to do? And I think that is what
Aleksey was trying to explain as well.

Correct me if I'm wrong though.

Dirk Gerrits


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