Open
Description
Right now there is an implicit conversion from a match (more explicitly from a captured_content::storage as I can see). I wonder if it was possible to convert a match to std::partial_ordering to obtain more information from a non-match. The semantics of the returned values would be:
- std::less/std::greater : Not a match and the subject orders lexicographically before/after all possible strings that match the regular expression.
- std::equivalent : It's a match.
- std::unordered : All else.
Use case: searching matching strings in a lexicographically ordered collection of strings efficiently. Right now there is no interface for std::map and std::set to allow this, but other maps and sets could offer searching with a partial_ordering predicate.
Some examples for return values:
constexpr auto re = ctre::match<"^abc[0-46-9]+$">;
static_assert(re("abc1"sv).to_partial_ordering() == std::equivalent);
static_assert(re("bac1"sv).to_partial_ordering() == std::greater);
static_assert(re("aaa1"sv).to_partial_ordering() == std::less);
static_assert(re("abc5"sv).to_partial_ordering() == std::unordered);