Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-01-22 10:28:26


Deane Yang wrote:
> It appears to me that the efforts to replace "pi()" by "pi" are
> both testing the limits of current compilers AND delaying the review
> of the constants library. Why can't we get moving on the constants
> library with a correct C++ interface and, if a simpler interface is
> developed later, modify the library later (with backwards compatibility,
> which should not be a problem)?

The problem with constants is generic programming. Consider:

template< typename T > T area( const T& r ) {
    return pi * r * r;
}

Now think of different T's, mixed arithmetics, loss of precision, no
conversion from double to T (e.g. boost::rational, Roguewave's
RWDecimal<>, ...). You need a pi in the above example which is truly
generic. *That* is what I'm working on, the syntax pi vs. pi() is just
syntactic sugar (although I strongly prefer pi over pi()). More on that
when I finished the restructuring due to the unit libraries :)

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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