Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-28 13:48:13


I don't know if anyone's pointed it out yet, but symbols like _PI are
reserved to the implementation (i.e. hands off!). Can we choose something
else instead?

Best Regards,
Dave

----- Original Message -----
From: "Paul A. Bristow" <pbristow_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, March 28, 2001 6:04 AM
Subject: RE: [boost] Re: Maths Constants

> Since nobody has posted a solution to this, I have devised a draft for
> comments.
>
> Only a couple of constants implemented for clarity of the concept.
>
> There are four (types of) header files
>
> 1 .h C style preprocessor #define files with ~define _PI = 31.1459...L
> 2 .h C style preprocessor #undef _PI files (do avoid name clash
problems).
> 3 .hpp C++ template function as below.
> 4 .hpp C++ const long double variables const long double pi =
31.1459...L.
> 5 .hpp C++ const double version, perhaps?
>
> the two .hpp files both include #define file 1 at the start and end with
the
> #undef file 2.
>
> I foresee 3 ways of using the files.
>
> 1 #include preprocessor #define _PI files and use these directly, C
> programs mainly.
>
> 2 Use #include file for extern long double const pi; (static?)
>
> 3 Use template function math_constants<float>pi() as suggested below:
>
> > > -----Original Message-----
> > > From: k.hagan_at_[hidden] [mailto:k.hagan_at_[hidden]]
> > > Sent: Tuesday, February 13, 2001 9:52 AM
> > > To: boost_at_[hidden]
> > > I still don't like the namespace pollution that #define causes.
> > > What was the objection to something like...?
> > >
> > > template<class T> struct math_constants /*==namespace*/
> > > {
> > > static T e() { return T(_PI); }
> > > };
>
> If this meets peoples requirements, I will undertake the more arduous
task
> of generating the constants as #define _PI = 3.1459...L etc.
>
> A working example of the files attached (concatentated). I will copy a
MSVC
> 6 SP4 version to the vault if requested.
>
> Comments please!
>
> Paul
>
> PS Do we want to split the .hpp files into two (or more) groups, one for
> basic constants and another for the more esoteric/exotic/erotic?
> (I would want to keep the .h files the same for simple maintenance).
>
> Dr Paul A Bristow, hetp Chromatography
> Prizet Farmhouse
> Kendal, Cumbria
> LA8 8AB UK
> +44 1539 561830
> mailto:pbristow_at_[hidden]
>
>
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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