Subject: Re: [boost] [complex] Feedback and Potential Review Manager
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-05-06 04:28:46
> I implemented this but it seems to add limitations on the
> types usable. They now require to have an overloaded
> istream extraction operator and a specialization of
> std::numeric_limits. Those two limitations are reasonable
> but I am not certain that we want to impose such conditions
> on the template types.
The requirements are more subtle than that, the logic goes something like
* If there's a numeric_limits specialization:
* If the precision is less than a float/double/long double, and T is
constructible from those types, then construct from float/double/long
* If the precision is < 100 decimal places:
* If T is constructible from a const char* then construct the
constant that way.
* Use the iostream operator to stream the constant in (we could
arguably use a trait to check whether this is supported before using it as
* Precision > 100 digits - calculate the constant and cache the result.
* No numeric_limits - use boost::math::tools::digits<T>() to check runtime
precision and pick either construct-from string or calculate the constant.
There's also a trait class that can be specialized for some type T to
override the above logic.
So you don't have to have either numeric_limits or an iostream operator, but
you have to have *something* that allows us to get the constant in there.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk