Boost logo

Boost :

From: Herve Bronnimann (hbr_at_[hidden])
Date: 2002-09-07 04:14:20


On Fri, Sep 06, 2002 at 08:14:14PM -0400, Sylvain Pion wrote:
> So now can you answer my initial question, then ? Is there a nicer
> way to do it, and if yes, which one ?
>
> (template stuff is nice, but it doesn't really simplify the complexity
> I'd like to get rid of, i.e. that all cases of digits/radix basically
> have to be treated separately).

You're right, in the template stuff as well as in the ?: solution,
you have to supply a different decimal string for your
constants. And it's easy once all the parameters are known to compute
the constants off-line and put them in the compile-time header.

But I thought at least with the template stuff it's easy to add them
independently one by one, so you can divide them up into headers and
include only the headers that specify the specializations that are relevant for your setup. Pretty much the same way as roundings are specified with one header per platform in interval/detail/...

But that's still an awful lot of constants to provide and you probably
want to write a script to generate those headers. The advantage of
template<int> solution over ?: is that you can provide the script, so
users can generate the missing header for their platform if you don't
supply it. Whereas it's impossible for them (short of modifying the
library code) to change the ?: expression.

Now you are still looking for a solution that would bypass that, and
that's a worthy goal. The above is just a solution within what is known
to work already.
My two cents,

-- 
Herve'

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