diff --git a/src/Helpers/BiMap.hpp b/src/Helpers/BiMap.hpp index ffce6b4c..b83ce4c0 100644 --- a/src/Helpers/BiMap.hpp +++ b/src/Helpers/BiMap.hpp @@ -32,15 +32,15 @@ namespace Bloom } } - bool contains(TypeA key) const { + bool contains(const TypeA& key) const { return this->map.find(key) != this->map.end(); } - bool contains(TypeB key) const { + bool contains(const TypeB& key) const { return this->flippedMap.find(key) != this->flippedMap.end(); } - std::optional valueAt(TypeA key) const { + std::optional valueAt(const TypeA& key) const { std::optional output; if (this->contains(key)) { @@ -50,7 +50,7 @@ namespace Bloom return output; } - std::optional valueAt(TypeB key) const { + std::optional valueAt(const TypeB& key) const { std::optional output; if (this->contains(key)) { @@ -60,16 +60,15 @@ namespace Bloom return output; } - const TypeB& at(TypeA key) const { + const TypeB& at(const TypeA& key) const { return this->map.at(key); } - const TypeA& at(TypeB key) const { - return this->flippedMap.at(key); + const TypeA& at(const TypeB& key) const { return this->flippedMap.at(key)->first; } - std::unordered_map getMap() const { + [[nodiscard]] std::unordered_map getMap() const { return this->map; }