perf: simplify for loops and lambdas, etc

This commit is contained in:
Horror Proton
2022-08-09 14:54:18 +08:00
parent 01b05fd85d
commit 08c153de3e
12 changed files with 20 additions and 61 deletions

View File

@@ -36,10 +36,7 @@ bool asst::InfrastPowerTask::_run()
opers_detect();
}
auto find_iter = ranges::find_if(m_all_available_opers,
[&](const infrast::Oper& info) -> bool {
return info.selected;
});
auto find_iter = ranges::find_if(m_all_available_opers, std::mem_fn(&infrast::Oper::selected));
bool need_shift = true;
if (find_iter != m_all_available_opers.end()) {
switch (m_work_mode) {