diff --git a/deps/ox/src/ox/std/smallmap.hpp b/deps/ox/src/ox/std/smallmap.hpp index db2fa3eb..f8b58c4d 100644 --- a/deps/ox/src/ox/std/smallmap.hpp +++ b/deps/ox/src/ox/std/smallmap.hpp @@ -29,11 +29,12 @@ class SmallMap { K key = {}; T value{}; }; + using PairVector = Vector; Vector m_keys; - Vector m_pairs; + PairVector m_pairs; public: - explicit constexpr SmallMap(std::size_t size = 127); + constexpr SmallMap() = default; constexpr SmallMap(SmallMap const&other); @@ -68,17 +69,13 @@ class SmallMap { private: template - constexpr Pair const&access(Vector const&pairs, KK const&key, bool &isNew) const; + constexpr Pair const&access(PairVector const&pairs, KK const&key, bool &isNew) const; template - constexpr Pair &access(Vector &pairs, KK const&key, bool &isNew); + constexpr Pair &access(PairVector &pairs, KK const&key, bool &isNew); }; -template -constexpr SmallMap::SmallMap(std::size_t size): m_pairs(size) { -} - template constexpr SmallMap::SmallMap(SmallMap const&other) { m_pairs = other.m_pairs; @@ -188,13 +185,12 @@ constexpr Vector const&SmallMap::keys() const noexcept { template constexpr void SmallMap::clear() { m_pairs.clear(); - m_pairs.resize(127); } template template constexpr typename SmallMap::Pair const&SmallMap::access( - Vector const&pairs, KK const&k, bool &isNew) const { + PairVector const&pairs, KK const&k, bool &isNew) const { for (auto const&p : pairs) { if (p.key == k) { isNew = false; @@ -209,7 +205,7 @@ constexpr typename SmallMap::Pair const&SmallMap::access( template template constexpr typename SmallMap::Pair &SmallMap::access( - Vector &pairs, KK const&k, bool &isNew) { + PairVector &pairs, KK const&k, bool &isNew) { for (auto &p : pairs) { if (p.key == k) { isNew = false;