codebase wide: replace count with contains
C++20 introduced `contains` member functions for maps and sets for checking whether an element is present in the collection. Previously `count` function was often used in various ways. `contains` does not only express the intend of the code better but also does it in more unified way. This commit replaces all the occurences of the `count` with the `contains`. Tests: unit(dev) Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com> Message-Id: <b4ef3b4bc24f49abe04a2aba0ddd946009c9fcb2.1597314640.git.piotr@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
6d7393b0df
commit
c001374636
@@ -535,7 +535,7 @@ public:
|
||||
}
|
||||
|
||||
bool is_schema_version_known(schema_ptr s) {
|
||||
return _known_schema_versions.count(s->version());
|
||||
return _known_schema_versions.contains(s->version());
|
||||
}
|
||||
void add_schema_version(schema_ptr s) {
|
||||
_known_schema_versions.emplace(s->version());
|
||||
@@ -1582,7 +1582,7 @@ future<> db::commitlog::segment_manager::shutdown() {
|
||||
}
|
||||
|
||||
void db::commitlog::segment_manager::add_file_to_delete(sstring filename, descriptor d) {
|
||||
assert(!_files_to_delete.count(filename));
|
||||
assert(!_files_to_delete.contains(filename));
|
||||
_files_to_delete.emplace(std::move(filename), std::move(d));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user