libstdc++: Reduce uses of std::numeric_limits
authorJonathan Wakely <jwakely@redhat.com>
Mon, 5 Oct 2020 23:05:11 +0000 (00:05 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 5 Oct 2020 23:05:11 +0000 (00:05 +0100)
commit9af65c2b9047168f14e623d55f87beda33ba1503
treebed8b420d0dd9cbb74392afae4b379de69c79d4e
parent66a032079309069fec085fff2a014ac217ce5781
libstdc++: Reduce uses of std::numeric_limits

This avoids unnecessary instantiations of std::numeric_limits or
inclusion of <limits> when a more lightweight alternative would work.
Some uses can be replaced with __gnu_cxx::__int_traits and some can just
use size_t(-1) directly where SIZE_MAX is needed.

libstdc++-v3/ChangeLog:

* include/bits/regex.h: Use __int_traits<int> instead of
std::numeric_limits<int>.
* include/bits/uniform_int_dist.h: Use __int_traits<T>::__max
instead of std::numeric_limits<T>::max().
* include/bits/hashtable_policy.h: Use size_t(-1) instead of
std::numeric_limits<size_t>::max().
* include/std/regex: Include <ext/numeric_traits.h>.
* include/std/string_view: Use typedef for __int_traits<int>.
* src/c++11/hashtable_c++0x.cc: Use size_t(-1) instead of
std::numeric_limits<size_t>::max().
* testsuite/std/ranges/iota/96042.cc: Include <limits>.
* testsuite/std/ranges/iota/difference_type.cc: Likewise.
* testsuite/std/ranges/subrange/96042.cc: Likewise.
libstdc++-v3/include/bits/hashtable_policy.h
libstdc++-v3/include/bits/regex.h
libstdc++-v3/include/bits/uniform_int_dist.h
libstdc++-v3/include/std/regex
libstdc++-v3/include/std/string_view
libstdc++-v3/src/c++11/hashtable_c++0x.cc
libstdc++-v3/testsuite/std/ranges/iota/96042.cc
libstdc++-v3/testsuite/std/ranges/iota/difference_type.cc
libstdc++-v3/testsuite/std/ranges/subrange/96042.cc