
16 Mar
2005
16 Mar
'05
3:54 p.m.
There is still an open issue how to use numeric_limits in generic function. Any ideas?
I guess I could use is_float, but then I cut any UDT that does specialize numeric_limits.
I think Peter Dimov spotted the problem here: numeric_limits does provide a default specialisation, but it won't instantiate unless T is a type that can be returned from a function, which means it may not be: An incomplete type, An abstract type, An array type, A function type. I think you can get close to this, by only using numeric_limits if is_object<T>::value is true (you could test for abstract types as well with is_abstract, but that template works with only a minority of compilers). Does this help? John.