|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-10-23 09:07:50
"Andy Little" <andy_at_[hidden]> writes:
> "David Abrahams" wrote
>> "Andy Little" writes:
>>
>>> I am arguing for a normalised version, so for my_rational<2,8>,
>>> my_rational<3,12> and my_rational<5,20> among others, the normalised
>>> version
>>> is my_rational<1,4> and thats what I think rational<...>::type should return.
>>
>> Why should that normalization be done eagerly? I can see no good
>> reason for it.
>
> Numerator and denominator members are evaluated already . I guess you could
> remove them....
I don't see what the presence of numerator and denominator has to do
with normalization.
> [cut]
>
>> Is it daft to want my_rational<x,1> to be a conforming MPL integral
>> constant?
>
> Who wants special cases?
Who suggested a special case?
> integral constant can be converted to a
> rational constant, but not necessarily the other way.
Don't forget that the types are all known at compile-time. The usual
runtime logic doesn't necessarily apply. A conversion from
my_rational<x,1> to int_<x> is not a narrowing conversion.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk