diff options
author | Sadie Powell <sadie@witchery.services> | 2023-10-10 21:14:50 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-10-11 15:51:52 +0100 |
commit | a3241065c55fd2a69e8793b89a5d0b1a957b3fd0 (patch) | |
tree | 82f80ce2f3bbbdc1c1ef05fe611093cf0b34eab6 /include/modules/sql.h | |
parent | dc371aad6d059dbf7f30f6878c680532bedd4146 (diff) |
Start migrating to range-based for loops.
Diffstat (limited to 'include/modules/sql.h')
-rw-r--r-- | include/modules/sql.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/include/modules/sql.h b/include/modules/sql.h index ff441302b..607f8bcd9 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -34,32 +34,34 @@ namespace SQL std::set<Anope::string> KeySet() const override { std::set<Anope::string> keys; - for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) - keys.insert(it->first); + for (const auto &[key, _] : this->data) + keys.insert(key); return keys; } size_t Hash() const override { size_t hash = 0; - for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) - if (!it->second->str().empty()) - hash ^= Anope::hash_cs()(it->second->str()); + for (const auto &[_, value] : this->data) + { + if (!value->str().empty()) + hash ^= Anope::hash_cs()(value->str()); + } return hash; } std::map<Anope::string, std::iostream *> GetData() const { std::map<Anope::string, std::iostream *> d; - for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) - d[it->first] = it->second; + for (const auto &[key, value] : this->data) + d[key] = value; return d; } void Clear() { - for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) - delete it->second; + for (const auto &[_, value] : this->data) + delete value; this->data.clear(); } |