
30 Jan
2009
30 Jan
'09
5:12 p.m.
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.