Boost logo

Boost Users :

Subject: Re: [Boost-users] mpl documentation question
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-04-07 13:47:14


Vicente J. Botet Escriba wrote:
> Le 07/04/12 09:13, Robert Ramey a écrit :
>> Documentation for mpl::less<T> has the following section:
>>
>>
>> typedef less<c1,c2> r; // a
>>
>> Return type:Integral Constant.
>> Semantics:Equivalent to
>> struct r : less<c1,c2>::type {}; //b
>>
>> if //a is used then the following yields bool_<true>
>>
>> is_same< less<c1, c2>, r>
>>
>> if // b is used then the following yields bool_<false>
>>
>> is_same< less<c1, c2>, r>
>>
>> So in what sense are //a and // b equivalent?
>>

> Hi,
> they are not equivalents. The equivalence relation appears via the
>>> type access.
>
> is_same< less<c1, c2>::type, r::type>
>
> should be true_type in both cases.
>
> This is because integral_constant<typename T, T V> defines a nested
> typedef 'type' as itself.

Hmmm - this helps understand why I've always been confused about
when to use "less<c1,c2>::type" vs "less<c1,c2>". Note that it doesn't
clarify my confusion itself - it just clarifies why I've always been
confused - which of course is an entirely different thing.

So you agree that the statement above (which appears in the documentation)

>> typedef less<c1,c2> r; // a
>>
>> Return type:Integral Constant.
>> Semantics:Equivalent to
>> struct r : less<c1,c2>::type {}; //b

is incorrect and misleading?

I'm thinking that it shouldn't even be in the documentation as written.
This raises the question as to what the documentation should say
about the type "less<c1, c2>" ?

>
> HTH,
> Vicente


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