migrate to std::ranges

Move the various seq_ functions, as well as std::(stable_)sort,
std::accumulate, std::transform, std::find, std::find_if to their C++20
std::ranges counterparts.
This commit is contained in:
Dirk-Jan C. Binnema
2026-07-24 21:28:58 +03:00
committed by Seth Ladygo
parent 1b42ad6099
commit 4489d513be
29 changed files with 71 additions and 131 deletions

View File

@ -354,7 +354,7 @@ needs_separator(std::string_view tagname)
constexpr auto nosep_tags = std::to_array<const char*>({
"b", "em", "i", "s", "strike", "tt", "u"
});
return !seq_some(nosep_tags, [&](auto&& t){return matches(tagname, t);});
return !std::ranges::any_of(nosep_tags, [&](auto&& t){return matches(tagname, t);});
}
static bool // do we need to skip the element completely?
@ -363,7 +363,7 @@ is_skip_element(std::string_view tagname)
constexpr auto skip_tags = std::to_array<const char*>({
"head", "title"
});
return seq_some(skip_tags, [&](auto&& t){return matches(tagname, t);});
return std::ranges::any_of(skip_tags, [&](auto&& t){return matches(tagname, t);});
}
// skip the end-tag
@ -518,7 +518,7 @@ html_escape_char(Context& ctx)
if (matches(esc, n.name))
return std::string{n.repl};
if (seq_some(accents, [&](auto&& a){
if (std::ranges::any_of(accents, [&](auto&& a){
return starts_with(esc.substr(1), a);}))
return std::string(1, to_ascii_lower(esc.front()));