Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-05-08 06:06:22


Andy Little wrote:
>
> "Tobias Schwinger" <tschwinger_at_[hidden]> wrote
>
>> Static constants in "<type>_constants"-namespaces are also
>> undesirable, because there is no way to select a namespace named
>> "<T>_constants" from within a template.
>
>
> FWIW thi would work fine for me:
>
> typedef std::math::constants<T> math;
> 2 * math::pi * r ;

This looks nice at first glance.

Besides getting rid of the empty parentheses, there are the following disadvantages:

- modularity/extensibility (once constants<T> is defined you can't add constants
to it)
- portability (the code above won't compile with BCC)
- there is no way to pass constants as a type template argument

Regards,

Tobias


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