From 73ddc307ebe3e10b29bcae4f33e5373f78a393b0 Mon Sep 17 00:00:00 2001 From: cat Date: Mon, 2 Mar 2026 04:08:25 +0200 Subject: [PATCH] Added noexcepts and nodiscards --- headers/Containers/Hashmap.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/headers/Containers/Hashmap.hpp b/headers/Containers/Hashmap.hpp index dd23fd7..a9e1248 100644 --- a/headers/Containers/Hashmap.hpp +++ b/headers/Containers/Hashmap.hpp @@ -59,7 +59,8 @@ public: --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), keyHashPosition = keyHash % storage.size(); @@ -77,6 +78,7 @@ public: return false; } + [[nodiscard("Unnecessary call of Get function")]] Value &Get(const Key &key) { std::size_t keyHash = std::hash{}(key), keyHashPosition = keyHash % storage.size(); @@ -108,7 +110,10 @@ public: count = 0; } - std::size_t Count() { return count; } + [[nodiscard("Unnecessary call of Count function")]] + std::size_t Count() noexcept { + return count; + } private: struct hashStorage {