Boost logo

Boost Users :

From: Edward Diener (eldiener_at_[hidden])
Date: 2008-05-06 15:30:07


Steven Watanabe wrote:
> AMDG
>
> Edward Diener wrote:
>> OK, I understand that placeholder expressions are not evaluated immediately.
>>
>> What does evaluating an expression immediately have to do with appending
>> '::type' ?
>>
>
> When MPL lambda tries to evaluate the placeholder expression it
> rips the type apart using template specialization and replaces all instances
> of the placeholders with the correct arguments. By not using ::type
> it is possible for mpl::lambda to to work without requiring every
> metafunction
> to know about lambda.

I understand the explanation about how placeholders work. The rule you
are specifying appears to be that one never adds the '::type' to the end
of a placeholder expression when it is being passed to an mpl construct.
Is that correct ?

>
>>> leaving the ::type of plus<...>
>>> is a shortcut which works for numeric metafunctions.
>>>
>> So is the rule in this regard that numeric metafunctions can be passed
>> around without having to specify '::type' ? If so, what set of MPL
>> metafunctions constitute the numeric matfunctions ?
>>
>
> Basically this shortcut works for any MPL metafunction that
> always returns an MPL Integral constant.

OK, I do understand that rule. I can easily isolate the MPL integral
constants. Thanks !

>
>>> mpl::inserter is an mpl object rather than an mpl metafunction.
>>>
>> So the rule here is that an mpl 'object' never needs a '::type' since it
>> is already a type ? If so, how do I tell which mpl constructs are mpl
>> 'objects' ?
>>
>
> The only answer I can think of is if something would correspond to a
> function
> at runtime than you need the ::type. If it refers to something that
> would be an
> object like integral constants and vectors, you don't.

I wish I knew what the is an mpl function as opposed to what is not an
mpl function. Perhaps the mpl algorithms are the mpl functions and
everything which is not an algorithm is not an mpl function.

> If your not
> sure, the
> only thing to do is look it up.

Look up what ? Where in the reference documentation does it tell me
whether I need to add '::type' to the end of an mpl construct ?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net