Boost logo

Boost :

From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2001-05-04 04:17:05

This indeed avoids the function brackets pi(),
(which to I prefer, being a mere cooking chemist)
but I don't how to get down to just pi using
some using or typedef so one can write

double area = pi * r * r;

User who are naive and experts who value clarity
both will demand this.

I have yet to discover how to do this,
probably being in the naive category,
but also demanding clarity.

(I have some suspicisions that this is due
to MS compiler 'limitations'? Do those that
have a real compiler have any solutions?)


  boost::math::constants<const double>::pi

is just too much

  pi<const double> is just bearable,

but it should be possible to disguise it and write just pi.

Does one have to create
  double pi = boost::math::constants<const double>::pi; ?
But this involves extra code.


PS I can fairly easily generate separate headers for MACROS, functions,
and your suggestion static members.

Do you favour this compromise?

> -----Original Message-----
> From: Petr Kocmid [mailto:pkocmid_at_[hidden]]
> Sent: Thursday, May 03, 2001 10:39 PM
> To: boost_at_[hidden]
> Subject: RE: [boost] Re: Math Constants
> > -----Original Message-----
> > From: k.hagan_at_[hidden] [mailto:k.hagan_at_[hidden]]
> > Sent: Tuesday, May 01, 2001 11:11 AM
> > To: boost_at_[hidden]
> > Subject: [boost] Re: Math Constants
> > > I'm losing track of what has and hasn't been suggested. Have we
> > > considered specialising a class template with a static member?
> > >
> > > template<class T> class math
> > > {
> > > static T const pi;
> > > };
> >
> Since I use happily this technique, I already suggested a static member
> constant wrapped in empty class with specialisation by template
> argument in
> early stage of the discussion, but had been beaten by some purist stating
> that function interface is better for inlining. On some platfroms with
> certain compilers, it's really true. Please look into archives for
> discussion details. I still feel that function interface obfuscates user
> code unnecesarily, and my solution is to generate headers in
> this style at
> the moment the constant data will appear in the boost cvs.
> Petr Kocmid
> pkocmid_at_[hidden]
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
> Your use of Yahoo! Groups is subject to

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