Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-10-23 18:47:21


"Andy Little" <andy_at_[hidden]> writes:

> "David Abrahams" wrote
>> "Andy Little" writes:
>
>> I don't see what the presence of numerator and denominator has to do
>> with normalization.
>
> They should be typedefs for the input parameters?

What does that have to do with normalization?

>>>> 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?
>
> Whoever said , " Is it daft to want my_rational<x,1> to be a
> conforming MPL integral constant?" .

That doesn't require any special case code.

>>> 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.
>
> Conversion is fine. Thats not what you said above.

No, it's not what I said above. Remember, the usual runtime logic
doesn't necessarily apply. my_rational<x,1> can be an integral
constant *at compile time*. I'm not sure it's useful, but it's not
insane.

-- 
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