-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish P0768R1 by adding Spaceship CPOs #1370
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I had a tiny question about the include chain and another one regarding readability
@miscco, @CaseyCarter - I've addressed your feedback with:
I also added a couple of additional changes:
|
Co-authored-by: Casey Carter <[email protected]>
Explicitly convert the (potentially user-defined) result of ADL meow_order to meow_ordering, before converting it to the final type.
{10, bit_cast<float>(0xFFC00000u)}, // negative quiet NaN, no payload bits | ||
{20, -numeric_limits<float>::infinity()}, // negative infinity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need test coverage for signaling NaNs?
Note that it could be currently impossible to generate a float
signaling NaN on the MSVC compiler at compile time. It emits a quiet NaN for bit_cast<float>(0xFF800001u)
or numeric_limits<float>::signaling_NaN()
.
Same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, yes, this would test signaling NaNs - but as you noted, the compiler bugs make it difficult. I think we can live without test coverage for them, given that the code is clearly written to handle them uniformly (the main question is whether I got the "infinity plus one" logic correct, but I think that can be verified by inspecting the code).
All this header does is include `stdint.h` and provide typedefs.
Resolves #64 by implementing WG21-N4861's spaceship customization point objects specified in [cmp.alg].
Note that this is targeted at
master
, as it doesn't directly interact with #62 which is being developed infeature/spaceship
.<charconv>
_Floating_type_traits
into a central header,<type_traits>
. It was the only thing using<float.h>
here (forFLT_MANT_DIG
etc.).<type_traits>
<cstdint>
needed by_Floating_type_traits
. This is a very small header, "core" compatible, and it's actually surprising that<type_traits>
wasn't already dragging it in._Floating_type_traits
here. It's functionally unchanged, except that I've eliminated the<float.h>
dependency by directly writing out the literal values. I believe that this makes the masks easier to understand, and I've retained the original computations as comments._Floating_type_traits<long double>
, needed now but not by<charconv>
.<charconv>
includes<xutility>
includes<utility>
includes<type_traits>
.<compare>
includes (in concepts mode)<concepts>
includes<type_traits>
.<xutility>
std::ranges::_Choice_t
andstd::_Implicitly_convertible_to
into a central header,<concepts>
. Both will remain guarded by__cpp_lib_concepts
._Choice_t
is additionally being lifted out tostd
.<xutility>
includes<utility>
includes (in concepts mode)<concepts>
.<compare>
<bit>
forbit_cast
. It's a "core" header, although it does drag in<limits>
._Bit_cast
in<xutility>
up to<type_traits>
, except that it wantsmemcpy
for__CUDACC__
and<type_traits>
doesn't include<cstring>
. Maybe we could write a raw byte-copying loop?_Choice
/_Strategy
system.<yvals_core.h>
__cpp_lib_concepts
. Note that__cpp_lib_three_way_comparison
is being defined to the lower value201711L
for P0768R1; it will be increased to the larger value201907L
for P1614R2.tests/libcxx/expected_results.txt
tests/libcxx/skipped_tests.txt
tests/std/tests/VSO_0157762_feature_test_macros/test.cpp
tests/std/test.lst
tests/std/tests/P0768R1_spaceship_cpos/env.lst
tests/std/tests/P0768R1_spaceship_cpos/test.cpp
concepts_matrix
, but we don't need the strict concepts matrix - I was able to resolve all of the issues with/permissive
mode).test_floating()
, I've devised a system to test every possible "interesting" pair of floating-point values.