diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-04-08 16:16:10 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-04-08 16:16:10 +0100 |
commit | e18cd376e0d5ffc2a2b21eba0c396a771c30e1d4 (patch) | |
tree | e1d9ad6e5dc9494a76e22bd5128788663af579b7 /libstdc++-v3/include/std/charconv | |
parent | ef684c7827361e7e66543b4511fb1ca15ace4b1f (diff) | |
download | gcc-e18cd376e0d5ffc2a2b21eba0c396a771c30e1d4.zip gcc-e18cd376e0d5ffc2a2b21eba0c396a771c30e1d4.tar.gz gcc-e18cd376e0d5ffc2a2b21eba0c396a771c30e1d4.tar.bz2 |
libstdc++: Add comparison operators to <charconv> result types
Some more C++20 changes from P1614R2, "The Mothership has Landed".
* include/std/charconv (to_chars_result, from_chars_result): Add
defaulted equality comparisons for C++20.
* testsuite/20_util/from_chars/compare.cc: New test.
* testsuite/20_util/to_chars/compare.cc: New test.
Diffstat (limited to 'libstdc++-v3/include/std/charconv')
-rw-r--r-- | libstdc++-v3/include/std/charconv | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv index 8c9ce9d..3caa0f8 100644 --- a/libstdc++-v3/include/std/charconv +++ b/libstdc++-v3/include/std/charconv @@ -44,7 +44,8 @@ #include <bits/error_constants.h> // for std::errc #include <bits/int_limits.h> -// Define when floating point is supported: #define __cpp_lib_to_chars 201611L +// FIXME: Define when floating point is supported: +// #define __cpp_lib_to_chars 201611L namespace std _GLIBCXX_VISIBILITY(default) { @@ -55,6 +56,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { char* ptr; errc ec; + +#if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L + friend bool + operator==(const to_chars_result&, const to_chars_result&) = default; +#endif }; /// Result type of std::from_chars @@ -62,6 +68,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { const char* ptr; errc ec; + +#if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L + friend bool + operator==(const from_chars_result&, const from_chars_result&) = default; +#endif }; namespace __detail |