Boost logo

Boost :

From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2001-03-26 17:39:31

> -----Original Message-----
> From: k.hagan_at_[hidden] [mailto:k.hagan_at_[hidden]]
> Sent: Tuesday, February 13, 2001 9:52 AM
> To: boost_at_[hidden]
> Subject: [boost] Re: Maths Constants
> > This is one reason for providing the constants in crude pre-
> > processor #define form for all possible uses, and then providing
> > a C++ representation which should be as portable as possible for
> > the Standard.

I feel it would be useful to produce a file mathconst.h
which is useful for the C men who will prefer #define _PI form I suspect?

(As well as a file mathconst.hpp for the C++ Boosters?)

> 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(2.718...L); }
> };

(As a relative novice, I don't like having to write pi()
rather than plain pi which the naive const long pi = 3.1459....; permits. )
(If you miss the (), the MSVC compiler explodes messily!)

Can anyone suggest how to meet these conflicting requirements,
preferably without having to generate two separate files
(that is the .hpp file should #include the .h file?).

(You have also suggested that there should be mathconst1.hpp, mathconst2.hpp
for differing degrees of obscurity of constant).

Thanks for suggestions.

Dr Paul A Bristow, hetp Chromatography
Prizet Farmhouse
Kendal, Cumbria
+44 1539 561830

Boost list run by bdawes at, gregod at, cpdaniel at, john at