We cannot pretend that ranges don't exist. While rightfully one does NOT want to reimplement the algorithms themselves¹, one should still
- reason in terms of iterator/sentinel pairs, instead of iterator/iterator
- detect if
<ranges> is available
- if so, use the algorithm overloads in
std::ranges (as they're the only ones that support iterator/sentinel)
Example:
QRegularExpression re = "\\d+";
auto matches = re.globalMatch(string);
auto matchesLengths = KDAlgorithms::transform(matches, [](const auto &m) { return m.capturedLength(); });
¹ even if simple (e.g. find_if). In other words, ranges should be supported up to the algorithmic call, after that one can require the user to be using a C++20 standard library.
We cannot pretend that ranges don't exist. While rightfully one does NOT want to reimplement the algorithms themselves¹, one should still
<ranges>is availablestd::ranges(as they're the only ones that support iterator/sentinel)Example:
¹ even if simple (e.g. find_if). In other words, ranges should be supported up to the algorithmic call, after that one can require the user to be using a C++20 standard library.