Re: extending std::numeric_limits
jamesrjones@gmail.com wrote:
On Mar 7, 10:12 am, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
..
template<class T, class U, class V>
class numeric_limits<DecimalType<T,U,V> > {
// extensions go here
};
V
This would work fine if DecimalType were a template. But it isn't.
What I have is this (for example):
template < class T, class U >
class fast_model_of_decimals {};
template < class T, class U >
class small_model_of_decimals {};
template < class T, class U >
class other_model_of_decimals {};
I could do this:
template < class T, class U >
class numeric_limits< fast_model_of_decimals< class T, class U > > {};
... and so on for the other models.
That's what you should (or have to) do.
But what I'd like to do is something like this:
template <typename T>
class numeric_limits< T > {};
where T must be a model of a decimal type.
You cannot do that because that is not a specialisation.
Note: I'm using BOOST and I'm familiar with enable_if, which works
great but doesn't quite seem to fit this application. I have a type
trait template is_decimal_type which returns true if the type is a
model of a fixed decimal type and false otherwise.
Just bite the bullet and specialise it for each of your templates.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask