|
Boost Users : |
Subject: Re: [Boost-users] mpl documentation question
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-04-07 14:17:50
AMDG
On 04/07/2012 12:05 PM, Robert Ramey wrote:
>
> That's interesting and useful. So I guess my problem is with the usage
> of the term "equivalent". I had interpreted this as "can be substituted
> for".
>
> So I'm now thinking that my original concern is justified - that the
> document
> doesn't accurately convey what "less<c1, c2>" really is.
Yes. I agree that the documentation needs
some work here.
> This has always
> been confusing to me - and still is. I totally get what "less<c1, c2>::type"
> is
> supposed to mean but the meaning and intended usage of "less<c1, c2>"
> is still lost on me.
>
Okay, I'll try to explain more clearly.
mpl::less<c1, c2>::type is the result of invoking
the metafunction. This is the way all metafunctions
work in MPL so no surprises here.
Now, mpl::less<c1, c2> is itself an MPL Integral
Constant. This works because MPL Integral Constant
is a Concept rather than a specific template.
In other words, if you only care about
the *value* of the result, and not the *exact type*,
then you can use mpl::less<c1, c2> instead of
typename mpl::less<c1, c2>::type. Just think
of this as a convenient short-cut for arithmetic
metafunctions.
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