|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-24 14:11:27
From: "Noah Stein" <noah_at_[hidden]>
> 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.
My line of thought is not that we must not provide a float pi - although
it's possible to! - but rather that we should keep things simple, and
provide the constants in the standard formats that we know about: float,
double, long double. So a more complete version would be
namespace math
{
float const pi_f = ...;
double const pi = ...;
long double const pi_l = ...;
}
Note: no 'constants' subnamespace. I know that 'pi' is a constant, thanks.
:-)
> I can use a single name for a constant, i.e. "pi", no matter what type I'm
> using.
double const & pi = math::pi;
or
float const & pi = math::pi_f;
Will this do?
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk