Add new helper traits for signed/unsigned integer types
authorJonathan Wakely <jwakely@redhat.com>
Wed, 26 Jun 2019 14:38:23 +0000 (15:38 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 26 Jun 2019 14:38:23 +0000 (15:38 +0100)
commit47f7905440afb294e8b6486196bc961527425739
tree72df26fa6ab612435a57d0f06017fbf18b87847f
parent7cbb1b721e650036a49dc0013397fee34af12800
Add new helper traits for signed/unsigned integer types

Reuse the __is_one_of alias in additional places, and define traits to
check for signed/unsigned integer types so we don't have to duplicate
those checks elsewhere.

The additional overloads for std::byte in <bit> were reviewed by LEWG
and considered undesirable, so this patch removes them.

* include/bits/fs_path.h (path::__is_encoded_char): Use __is_one_of.
* include/std/bit (_If_is_unsigned_integer_type): Remove.
(_If_is_unsigned_integer): Use __is_unsigned_integer.
(rotl(byte, unsigned), rotr(byte, unsigned), countl_zero(byte))
(countl_one(byte), countr_zero(byte), countr_one(byte))
(popcount(byte), ispow2(byte), ceil2(byte), floor2(byte))
(log2p1(byte)): Remove.
* include/std/charconv (__detail::__is_one_of): Move to <type_traits>.
(__detail::__is_int_to_chars_type): Remove.
(__detail::__integer_to_chars_result_type): Use __is_signed_integer
and __is_unsigned_integer.
* include/std/type_traits (__is_one_of): Move here from <charconv>.
(__is_signed_integer, __is_unsigned_integer): New helpers.
* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Remove test for
std::byte overload.
* testsuite/26_numerics/bit/bit.pow.two/floor2.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/ispow2.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/log2p1.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/countl_one.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/countl_zero.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/countr_one.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/countr_zero.cc: Likewise.
* testsuite/26_numerics/bit/bitops.count/popcount.cc: Likewise.
* testsuite/26_numerics/bit/bitops.rot/rotl.cc: Likewise.
* testsuite/26_numerics/bit/bitops.rot/rotr.cc: Likewise.

From-SVN: r272695
16 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/include/std/bit
libstdc++-v3/include/std/charconv
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/ceil2.cc
libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/floor2.cc
libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/ispow2.cc
libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/log2p1.cc
libstdc++-v3/testsuite/26_numerics/bit/bitops.count/countl_one.cc
libstdc++-v3/testsuite/26_numerics/bit/bitops.count/countl_zero.cc
libstdc++-v3/testsuite/26_numerics/bit/bitops.count/countr_one.cc
libstdc++-v3/testsuite/26_numerics/bit/bitops.count/countr_zero.cc
libstdc++-v3/testsuite/26_numerics/bit/bitops.count/popcount.cc
libstdc++-v3/testsuite/26_numerics/bit/bitops.rot/rotl.cc
libstdc++-v3/testsuite/26_numerics/bit/bitops.rot/rotr.cc