replace various find_if calls

C++11 has shorter equivalents.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2025-06-16 18:20:51 -07:00
committed by Jari Sundell
parent 47089bce70
commit f0517e2748
7 changed files with 11 additions and 13 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ object_storage::set_multi_key_obj(const torrent::raw_string& key, const std::str
if (r_itr == m_rlookup.end())
r_itr = m_rlookup.insert(std::make_pair(cmd_key, rlookup_type::mapped_type())).first;
if (std::find_if(r_itr->second.begin(), r_itr->second.end(), [key](value_type* type) { return key == type->first; }) == r_itr->second.end())
if (std::none_of(r_itr->second.begin(), r_itr->second.end(), [key](auto type) { return key == type->first; }))
r_itr->second.push_back(&*itr);
}
+1 -1
View File
@@ -57,7 +57,7 @@ parse_option_flag(const std::string& option, parse_option_flag_type ftor) {
if (first == next)
throw torrent::input_error(option);
if (std::find_if(next, last, [](char c) { return !std::isspace(c, std::locale::classic()); }) != last)
if (std::any_of(next, last, [](char c) { return !std::isspace(c, std::locale::classic()); }))
throw torrent::input_error(option);
return ftor(std::string(first, next));