|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2005-05-09 03:55:03
"Tobias Schwinger" <tschwinger_at_[hidden]> wrote
> Andy Little wrote:
>>
>> "Tobias Schwinger" <tschwinger_at_[hidden]> wrote
>>> - there is no way to pass constants as a type template argument.
>>
>> ( IOW use a function ..? )
>
> No. A class somehow like this:
>
> template<typename T> struct name;
>
> template<> struct name<TYPE>
> {
> operator TYPE() const { return ... };
> TYPE operator() () const { return ... };
> };
FWIW I had alook at this approach yesterday. see "test.cpp" attached. I think it
could be made to work. In unary contexts it requires explicit conversion, but I
guess there is no way around that. Of course you need an object..
boost::math::pi pi ; or a temporary.. boost::math::pi() ;. However I guess this
means you can use either pi or pi() syntax ... :-)
regards
Andy Little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk