Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-10-24 16:44:14


"David Abrahams" wrote

>> As it stands these two typedefs are normalized versions of the Numerator and
>> Denominator parameters.
>
> If you're trying to save cycles at compilation time by normalizing
> lazily, then of course the numerator and denominator typedefs can't be
> normalized. So, sure, typedefs for the template arguments sound fine
> to me.

I wouldnt mind this from a practical point of view. I believe that Cromwells
implementation of gcd is overkill for my needs, so I guess that would make it
easier to customise.

Overall though I am opposed to it because I believe the current interface is
superior from a users point of view and its a classic case of optimisation
ruling the interface.

In the case of dimensional analysis in a quantity, it seems to be perfectly
possible to mix rationals and integral constants in a mpl container, though some
care needs to be taken with the maths ( It may be worth using a custom division
operator). In use for dimensional analysis rationals are actually pretty rare
(integral constants can be substituted in the vast majority of cases) and all
rationals used have a very small range of values, so I hope that any poor
compile time performance of rationals will not have such a great effect. In
fact I think that division is the only operation where extra care is required
though any operation involving a rational requires normalisation if its involved
in math and comparisons etc.

I guess it might be worth getting Cromwell Enage's view as to whether he feels
changing the current interface is worthwhile.

regards
Andy Little


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk