topology: use std::erase_if on std::map instead of ad-hoc loop
There is std::erase_if since c++20. We can use it here. Message-Id: <20221228144944.3299711-6-gleb@scylladb.com>
This commit is contained in:
@@ -596,14 +596,7 @@ void token_metadata_impl::add_bootstrap_tokens(std::unordered_set<token> tokens,
|
||||
}
|
||||
}
|
||||
|
||||
// Unfortunately, std::remove_if does not work with std::map
|
||||
for (auto it = _bootstrap_tokens.begin(); it != _bootstrap_tokens.end();) {
|
||||
if ((*it).second == endpoint) {
|
||||
it = _bootstrap_tokens.erase(it);
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
std::erase_if(_bootstrap_tokens, [endpoint] (const std::pair<token, inet_address>& n) { return n.second == endpoint; });
|
||||
|
||||
for (auto t : tokens) {
|
||||
_bootstrap_tokens[t] = endpoint;
|
||||
|
||||
Reference in New Issue
Block a user