Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-03-28 18:22:21


Just as addition to the issue: here you deal with a set. And in the
Extensible Associative Sequence the position is ignored (at least according
to the docs). So you can skip the usage of end<Constraints>.

    * insert<Sequence,Pos,T> performs an insertion of type T at an arbitrary
position Pos in Sequence. Pos is ignored if Sequence is a model of
Extensible Associative Sequence.
    * insert<Sequence,T> is a shortcut notation for insert<Sequence,Pos,T>
for the case when Sequence is a model of Extensible Associative Sequence.

MSVC 8 compiles it in both cases with and without end< set<...> > and with
end< set<...> >::type to
boost::mpl::s_item<C,boost::mpl::set<A,B,boost::mpl::na,boost::mpl::na,boost
::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost:
:mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::
mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::m
pl::na> >

Best Regards,
Ovanes

-----Original Message-----
From: "JOAQUIN LOPEZ MU?Z" [mailto:joaquin_at_[hidden]]
Sent: Donnerstag, 29. März 2007 00:08
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [mpl] insert not inserting?

----- 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 mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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