Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-03-16 10:54:52

> 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?


Boost list run by bdawes at, gregod at, cpdaniel at, john at