diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-12-05 00:42:06 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-12-05 00:42:06 +0000 |
commit | 3a4cc6281b56c52136cc755e46776c025114d865 (patch) | |
tree | 204b53d72bcd8d72a429ccc276d959002b69f048 /libstdc++-v3/include/bits/cpp_type_traits.h | |
parent | 880c7b8c2570544ae4218374688a10a98c9d6542 (diff) | |
download | gcc-3a4cc6281b56c52136cc755e46776c025114d865.zip gcc-3a4cc6281b56c52136cc755e46776c025114d865.tar.gz gcc-3a4cc6281b56c52136cc755e46776c025114d865.tar.bz2 |
libstdc++: Implement spaceship for std::array (P1614R2)
As done for std::pair, this defines operator<=> as a non-member function
template and does not alter operator==, as expected to be proposed as
the resolution to an unpublished LWG issue.
Instead of calling std::lexicographical_compare_three_way the <=>
overload is implemented by hand to take advantage of the fact the
element types and array sizes are known to be the same.
* include/bits/cpp_type_traits.h (__is_byte<char8_t>): Add
specialization.
* include/std/array (operator<=>): Likewise.
* testsuite/23_containers/array/comparison_operators/constexpr.cc:
Test three-way comparisons and arrays of unsigned char.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
dg-error line numbers.
From-SVN: r278981
Diffstat (limited to 'libstdc++-v3/include/bits/cpp_type_traits.h')
-rw-r--r-- | libstdc++-v3/include/bits/cpp_type_traits.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index 3e165c7..28180bf 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -411,6 +411,15 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3) }; #endif // C++17 +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + struct __is_byte<char8_t> + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + // // Move iterator type // |