mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
Switch to using std::ranges algorithms
This commit is contained in:
parent
b4cbda4e02
commit
72c79006ac
42 changed files with 90 additions and 93 deletions
|
@ -293,7 +293,7 @@ ScriptFunc::ScriptFunc(std::string _name, FuncTypePtr ft, std::vector<StmtPtr> b
|
|||
bodies.push_back(std::move(b));
|
||||
}
|
||||
|
||||
std::stable_sort(bodies.begin(), bodies.end());
|
||||
std::ranges::stable_sort(bodies, std::ranges::greater(), &Body::priority);
|
||||
|
||||
if ( ! bodies.empty() ) {
|
||||
current_body = bodies[0].stmts;
|
||||
|
@ -315,7 +315,7 @@ ScriptFunc::~ScriptFunc() {
|
|||
}
|
||||
|
||||
bool ScriptFunc::IsPure() const {
|
||||
return std::all_of(bodies.begin(), bodies.end(), [](const Body& b) { return b.stmts->IsPure(); });
|
||||
return std::ranges::all_of(bodies, [](const Body& b) { return b.stmts->IsPure(); });
|
||||
}
|
||||
|
||||
ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
||||
|
@ -569,7 +569,7 @@ void ScriptFunc::AddBody(StmtPtr new_body, const std::vector<IDPtr>& new_inits,
|
|||
current_priority = b.priority = priority;
|
||||
|
||||
bodies.push_back(std::move(b));
|
||||
std::stable_sort(bodies.begin(), bodies.end());
|
||||
std::ranges::stable_sort(bodies, std::ranges::greater(), &Body::priority);
|
||||
}
|
||||
|
||||
void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue