|
Boost : |
From: Bill Seymour (bsey_at_[hidden])
Date: 2001-05-14 07:20:26
I've been thinking about some of the points that Skaller
and others brought up. How's this?
- I agree that functions such as abs() should be friends,
not members. I'm concerned, though, that some compilers
can't handle template friends. As a compromise, I suggest
leaving such functions in the class as helpers for the free
functions, and either leaving them undocumented or (better IMO)
documenting them as implementation details that have to be
public for portability to non-conforming implementations.
- I see Skaller's point about the two-argument ctor being
confusing. At first I thought about suggesting to users
that they think of the comma as a decimal point; but then
I caught myself writing an octal constant. 8-) I think
I've found a use for this ctor, though:
numeric_limits< decimal<Scale> >::epsilon();
returns decimal<Scale>(0, 1). I suggest making this ctor
one of the "public implementation details" mentioned above.
- I still think that users ought to be able to mix decimals
of different scale factors in expressions. I suggest that
the result type always be the type of the left-hand argument.
Users can always get a different type with an explicit cast.
- I tried a little coding using both BCD and one-digit-per-char
representations and found them _very_ expensive. I think
Skaller is right about doing just the 64-bit-int version.
--Bill Seymour
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk