From 4cc10ddc2130dd3b6dc4737356e683e611a0b9b5 Mon Sep 17 00:00:00 2001 From: cat Date: Wed, 28 Jan 2026 14:20:55 +0200 Subject: [PATCH] Added Scan() to go through the dualkey map --- headers/Containers/DualkeyMap.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/headers/Containers/DualkeyMap.hpp b/headers/Containers/DualkeyMap.hpp index eeb5031..733c1cf 100644 --- a/headers/Containers/DualkeyMap.hpp +++ b/headers/Containers/DualkeyMap.hpp @@ -124,7 +124,7 @@ public: return amountDeleted; } - [[nodiscard("Discarding an expensive operation's result!")]] + [[nodiscard("Discarding an expensive query!")]] std::vector query(std::optional firstKey, std::optional secondKey) { bool isFirstKeyGiven = firstKey.has_value(); @@ -180,6 +180,18 @@ public: return finishedQuery; } + void + scan(std::function scanFunction) { + for (DualkeyHash *hash : hashList) { + if (hash == nullptr) { + continue; + } + if (scanFunction(hash->firstKey, hash->secondKey, hash->value)) { + return; + } + } + } + [[nodiscard]] std::size_t count() { return hashList.size() - graveyard.size();