Boost logo

Boost :

Subject: Re: [boost] Numeric constants
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2009-01-30 12:12:48


John Maddock wrote:
>>> template <class T> T pi();
>>
>> I have a fixed-point class. What actually happens when I call
>> pi<fixed>() ?

> Currently with Boost.Math if you call:
>
> pi<my_UDT>()
>
> then internally it does a lexical_cast from a string containing ~100 decimal
> digits to my_UDT.

OK, I suppose that makes sense in general. My fixed class doesn't have
operator<<,>> unfortunately, since I've never needed them for anything else.

> And finally don't forget that you could add
> user-defined full specialisations of the templates for my_UDT if my_UDT
> provides its own interfaces to various constants.

Can I specialise all_constants<my_type> to cast from double without
having to write out all of the constants individually?

Phil.


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