portability macro for checking whether an expression satisfies a concept in a _CCCL_REQUIRES_EXPR clause
#6890
+35
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
when writing a concept definition in CCCL today, if you want to portably test whether a particular expression satisfies a given concept, you have to write it like:
in c++20, this expands to:
but that is not how you would write it in c++20, and the above formulation gives worse diagnostics than the more idiomatic:
requires(T& t) { {some-expression} -> my_concept; }this pr adds a new
_Satisfiesrequirement kind to CCCL's concept portability macros. it would be used like this:in c++20, this expands to the more idiomatic formulation
this pr also changes the
equality_comparableandtotally_orderedconcepts to use_Satisfies.Checklist