Switch to using std::ranges algorithms

This commit is contained in:
Tim Wojtulewicz 2025-07-18 17:06:09 -07:00
parent b4cbda4e02
commit 72c79006ac
42 changed files with 90 additions and 93 deletions

View file

@ -192,7 +192,7 @@ string CPPCompile::BodyName(const FuncInfo& func) {
auto canonicalize = [](char c) -> char { return isalnum(c) ? c : '_'; };
string fns = fn;
transform(fns.begin(), fns.end(), fns.begin(), canonicalize);
std::ranges::transform(fns, fns.begin(), canonicalize);
if ( ! isalpha(fns[0]) )
// This can happen for filenames beginning with numbers.

View file

@ -3065,10 +3065,10 @@ IDPtr ConstructFromRecordExpr::FindMostCommonRecordSource(const ListExprPtr& exp
return nullptr;
// Return the most common.
auto max_entry = std::max_element(id_cnt.begin(), id_cnt.end(),
[](const std::pair<IDPtr, int>& p1, const std::pair<IDPtr, int>& p2) {
return p1.second < p2.second;
});
auto max_entry =
std::ranges::max_element(id_cnt, [](const std::pair<IDPtr, int>& p1, const std::pair<IDPtr, int>& p2) {
return p1.second < p2.second;
});
return max_entry->first;
}