[committed] libstdc++: Add lightweight replacement for std::numeric_limits (PR 92546)

Jonathan Wakely jwakely@redhat.com
Mon Feb 17 17:19:00 GMT 2020


On 17/02/20 17:26 +0100, Daniel Krügler wrote:
>Am Mo., 17. Feb. 2020 um 16:33 Uhr schrieb Jonathan Wakely <jwakely@redhat.com>:
>>
>> Many uses of std::numeric_limits in C++17 and C++20 features only really
>> need the min(), max() and digits constants for integral types. By adding
>> __detail::__int_limits we can avoid including the whole <limits> header.
>
>numeric_limits has specializations for cv-qualified types, but for
>__ini_limits there is only an undefined specialization for bool.
>Shouldn't the same undefined specialization be provided for cv bool?
>It may be that currently all usages of that trait apply on already
>unqualified types, but this might be a fragile assumption.

The specialization for bool is only there to catch misuses by the
library, it's not really necessary. But I agree that also catching
errors for const bool makes sense. I don't think we need to care about
volatile.

I'm tempted to make __int_limits<const T> an error though, it's not
needed.



More information about the Libstdc++ mailing list