]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Implement std::strong_order for floating-point types [PR96526]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 3 Mar 2022 12:34:27 +0000 (12:34 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 3 Mar 2022 22:24:45 +0000 (22:24 +0000)
commit9805965e3551b66b5bd751d6076791d00cdeb137
tree288db4761d23164160d952f925428e5fea5b5281
parent51149a05b8cc8e4fc5a77a65857894daa371de89
libstdc++: Implement std::strong_order for floating-point types [PR96526]

This removes a FIXME in <compare>, defining the total order for
floating-point types. I originally opened PR96526 to request a new
compiler built-in to implement this, but now that we have std::bit_cast
it can be done entirely in the library.

The implementation is based on the glibc definitions of totalorder,
totalorderf, totalorderl etc.

I think this works for all the types that satisfy std::floating_point
today, and should also work for the types expected to be added by P1467
except for std::bfloat16_t. It also supports some additional types that
don't currently satisfy std::floating_point, such as __float80, but we
probably do want that to satisfy the concept for non-strict modes.

libstdc++-v3/ChangeLog:

PR libstdc++/96526
* libsupc++/compare (strong_order): Add missing support for
floating-point types.
* testsuite/18_support/comparisons/algorithms/strong_order_floats.cc:
New test.
libstdc++-v3/libsupc++/compare
libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order_floats.cc [new file with mode: 0644]
This page took 0.066259 seconds and 6 git commands to generate.