Provide library utilities for the three way comparison operator <=>
All threads resolved!
All threads resolved!
Compare changes
Add concepts Std::three_way_comparable
and Std::three_way_comparable_with
as well as an algorithm Std::lexicographical_compare_three_way
to provide library utilities for the <=>
comparison operator.
While C++20 introduces the operator <=>
into the language, not all standard libraries have implemented this comparison operator for std data structures, like tuple or array. Iterable containers could easily implement this operator using the lexicographic_compare_three_way
algorithms that works with iterators. Since not all types can be compared with <=>
, we also need to provide the concept definition that checks whether a type supports it. Also these concepts should be in the standard library, but are not yet fully implemented, especially in libc++-13.
This utility would allow to provide a three-way comparison operator for our Dune data structures FieldVector
, DynamicVector
and maybe also for the multi-dimensional array/span structures Std::mdarray
and Std::mdspan
. Especially for multi-indices a comparison and lexicographical ordering would be nice to have.