Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-06 14:41:42


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.

>> 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.

>> 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. If your not
sure, the
only thing to do is look it up.

In Christ,
Steven Watanabe


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