Added noexcepts and nodiscards

This commit is contained in:
2026-03-02 04:08:25 +02:00
parent ffe6dd83ca
commit 73ddc307eb

View File

@@ -59,7 +59,8 @@ public:
--count; --count;
} }
bool Has(const Key &key) { [[nodiscard("Unnecessary call of Has function")]]
bool Has(const Key &key) noexcept {
std::size_t keyHash = std::hash<Key>{}(key), std::size_t keyHash = std::hash<Key>{}(key),
keyHashPosition = keyHash % storage.size(); keyHashPosition = keyHash % storage.size();
@@ -77,6 +78,7 @@ public:
return false; return false;
} }
[[nodiscard("Unnecessary call of Get function")]]
Value &Get(const Key &key) { Value &Get(const Key &key) {
std::size_t keyHash = std::hash<Key>{}(key), std::size_t keyHash = std::hash<Key>{}(key),
keyHashPosition = keyHash % storage.size(); keyHashPosition = keyHash % storage.size();
@@ -108,7 +110,10 @@ public:
count = 0; count = 0;
} }
std::size_t Count() { return count; } [[nodiscard("Unnecessary call of Count function")]]
std::size_t Count() noexcept {
return count;
}
private: private:
struct hashStorage { struct hashStorage {