numeric_limits<array type> generates a compiler error

Daniel Krügler daniel.kruegler@gmail.com
Wed Feb 6 18:54:00 GMT 2013


2013/2/6 Andy Venikov <avenikov@google.com>:
> Correction: I can only pass arithmetic types to numeric_limits::is_integer

No, you can pass every type that can be a valid return type of a
function. The actual intention of
std::numeric_limits is to query scalar-like "value types". It won't
work for function types, nor for
array types or for abstract types, for example.

>> I thought I could use numeric_limits::is_integer. But it looks like
>> I'll have to have a second layer, as I can only pass integral types
>> to is_integer.

Yes, you need your own intermediate layer if you want to support every
type to query for.

- Daniel



More information about the Libstdc++ mailing list