Boost logo

Boost :

From: John Maddock (jm_at_[hidden])
Date: 2002-11-13 06:53:07

> Suppose I'm writing some generic piece of numeric code that can be
> instantiated with a User Defined Type (UDT).
> And further suppose that I need to detect whether the generic numeric type
> represents either integer or floating point values.
> Can I use type_traits is_integral<> (or is_float<>)? That is, is the user
> allowed to provide her own specializations of this templates?
> If not, how should I let the user tell whether her numeric UDT is
> integer/float/signed/etc...?

No, is_integer and is_float etc are for built-in types *only*. If you want
to detect UDT's that are pretending to be numbers, then you should use
std::numeric_limits<>, and provide a specialisation for these if required.

John Maddock

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