Boost logo

Boost Users :

From: Andy Little (andy_at_[hidden])
Date: 2006-02-25 08:40:55


"Peter Dimov" wrote
> Andy Little wrote:
>
>> An alternative suggestion is to explicitly specify what seems to be
>> the actual behaviour of arithmetic operations on int_'s, long's etc
>> in the documentation. The actual behaviour seems to be that these
>> functions invariably return an integral_c. It could then also be
>> specified that the value_type of the result is found by applying the
>> usual promotion rules to the types of each of the (non mpl::na)
>> arguments. That would at least tighten up any play in the current
>> specification.
>
> Isn't this what the docs already seem to say?
>
> http://www.boost.org/libs/mpl/doc/refmanual/plus.html

Nearly but not specifically

Return type: Integral Constant (Concept.)

Maybe it could be changed to (something like)

Return type: integral_c<
      typeof(c1::value + c2::value)
    , ( c1::value + c2::value )
> c;

This would guarantee that is_same can be used on the result. Currently I cant
assume that.

regards
Andy Little


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