Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-05-06 18:56:04


Edward,

Just wanted to add my 2 cent. That might help. You need ::type when you do
type calculations.
For example:

Access the type stored in a type sequence -> ::type
transform type sequence to another type sequence -> ::type
So meta-algorithms operate on types and result in new types -> ::type

You don't need ::type when you pass parameters or transport the contained
type(s), e.g.
Placeholder transports type parameter to a metafunction -> no ::type
vector of type passed to a metafunction also transports type(s) -> no ::type

Hope that helps.

Ovanes

P.S. sorry that I did not remove unrelated posting lines.

On Tue, May 6, 2008 at 9:44 PM, Steven Watanabe <watanabesj_at_[hidden]>
wrote:

> AMDG
>
> Edward Diener wrote:
> > 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 ?
> >
>
> You should never add ::type to a placeholder expression at all.
> Otherwise, the metafunction will probably get very confused.
>
> > 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.
> >
>
> Inserters, Sequences, and the types listed under "Data Types" are not
> metafunctions.
> Everything listed in a section with Metafunctions of Algorithms in its
> name are metafunctions.
>
> >> 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 ?
> >
>
> Here are two examples from the reference:
>
> template< typename Sequence , typename State , typename ForwardOp >
> struct accumulate <./accumulate.html> {
> typedef /unspecified/ type;
> };
>
> template< typename Seq >
> struct back_inserter <./back-inserter.html> {
> // /unspecified/
> // /.../
> };
>
> 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