Boost logo

Boost Users :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-03-28 18:07:49


----- Mensaje original -----
De: Scott Meyers <usenet_at_[hidden]>
Fecha: Miércoles, Marzo 28, 2007 11:49 pm
Asunto: Re: [Boost-users] [mpl] insert not inserting?
Para: boost-users_at_[hidden]

> Ovanes Markarian wrote:
> > mpl::insert is an own type but you need the new sequence type
> with is
> > accessed via:
> > mpl::insert<...>::type
>
> Thanks very much. When I change the corresponding to code to:
>
> typedef mpl::insert<Constraints,
> mpl::end<Constraints>,
> Base>::type BaseClasses;
>
> then Base is inserted, but the resulting sequence has only A and
> Base in it, not A and B and Base, i.e., the type B is somehow
> being lost. Any idea why?

I think you want to write

  mpl::end<Constraints>::type

> Also, I'll be honest: I don't know when to use ::type and when
> not to. Is there a good description somewhere (either online
> or in the MPL book) that will clarify the situation for me?

Well, excuse me if the following is obvious to you,
but ::type is to a metafunction what actual invocation is
to a run-time function. So, mpl::end<Constraints> refers
to the name of the entity, but does not actually compute
its "return value" unless you add the ::type suffix.
Sort of like the difference between &foo and foo() in the
run-time world.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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