|
Boost Users : |
From: Edward Diener (eldiener_at_[hidden])
Date: 2008-05-06 23:30:42
Ovanes Markarian wrote:
> 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
OK
> transform type sequence to another type sequence -> ::type
OK
> So meta-algorithms operate on types and result in new types -> ::type
There is nothing in the book or documentation reference about
"meta-algorithms", whatever they are.
>
> You don't need ::type when you pass parameters or transport the
> contained type(s), e.g.
What do you mean by the above ?
> Placeholder transports type parameter to a metafunction -> no ::type
OK.
> vector of type passed to a metafunction also transports type(s) -> no ::type
OK
>
> Hope that helps.
It helps a little but it does not break the two general cases in my mind
into all the specific instances of using mpl constructs in the reference.
I am gathering that the correct specific way to determine whether or not
to append "::type" is to look at the mpl construct and if it is a
metafunction, which has its own nested type, always append "::type".
More general rules regarding categories of decision about appending
"::type", as you have suggested above, seem very vague to me except in
specific cases which Steve and you have mentioned.
Eddie
>
> 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]
> <mailto: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 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