diff --git a/source/mijin/container/vector_map.hpp b/source/mijin/container/vector_map.hpp index 53e5fb3..5fe5a08 100644 --- a/source/mijin/container/vector_map.hpp +++ b/source/mijin/container/vector_map.hpp @@ -133,7 +133,8 @@ public: VectorMap& operator=(VectorMap&&) = default; auto operator<=>(const VectorMap& other) const noexcept = default; - TValue& operator[](const TKey& key) + template + TValue& operator[](const TIndex& key) { auto it = find(key); if (it != end()) @@ -143,7 +144,8 @@ public: return emplace(key, TValue()).first->second; } - const TValue& operator[](const TKey& key) const + template + const TValue& operator[](const TIndex& key) const { return at(key); } @@ -251,8 +253,9 @@ public: return eraseImpl(idx, count); } + template [[nodiscard]] - iterator find(const TKey& key) MIJIN_NOEXCEPT + iterator find(const TSearch& key) MIJIN_NOEXCEPT { for (std::size_t idx = 0; idx < keys_.size(); ++idx) { @@ -264,8 +267,9 @@ public: return end(); } + template [[nodiscard]] - const_iterator find(const TKey& key) const MIJIN_NOEXCEPT + const_iterator find(const TSearch& key) const MIJIN_NOEXCEPT { for (std::size_t idx = 0; idx < keys_.size(); ++idx) {