|
Boost Users : |
Subject: Re: [Boost-users] mpl documentation question
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-04-07 05:06:09
Le 07/04/12 09:13, Robert Ramey a écrit :
> Documentation for mpl::less<T> has the following section:
>
>
> Expression semantics
> For any Integral Constants c1 and c2:
> typedef less<c1,c2>::type r;
>
> Return type:Integral Constant.
> Semantics:Equivalent to
> typedef bool_< (c1::value< c2::value)> r;
>
> 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.
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