Boost logo

Boost :

From: Noah Stein (noah_at_[hidden])
Date: 2001-10-24 13:56:28


> Dynamic init may be somewhat painful at times, I admit, but you can't
expect
> boost to generate the constants in every custom format, can you? It can
only
> provide a common framework into which you'd fill the constants in your
fixed
> point format.

I agree that boost itself cannot provide any constant in every conceivable
format. However, a system that supports constants in multiple formats, and
supports extension is a much preferable solution to having a constant in a
single format. If I use a type that isn't defined, I may define it myself.

I can use a single name for a constant, i.e. "pi", no matter what type I'm
using. This is especially useful since the true types of many of my numbers
are hidden behind typedefs. Should those typedefs change, as long as the
constant is defined for that type, I know that my code will still be
optimal.

I think Fernando's comment about template programming is valid, too. Pi
could be represented using some kind of Rational<int N, int D> template,
which is precisely how ancient Egyptians and Sumerians defined pi. A double
cannot be converted to the previous example.

-- Noah


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