From bc98c42be652553101c7bf721cefc3c05bdf0d57 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 13 Aug 2022 20:42:06 -0500 Subject: [PATCH] [ox/model] Make TypeStore::getInit always overwrite old value --- deps/ox/src/ox/model/typestore.hpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/deps/ox/src/ox/model/typestore.hpp b/deps/ox/src/ox/model/typestore.hpp index 488e6b9e..bba084bd 100644 --- a/deps/ox/src/ox/model/typestore.hpp +++ b/deps/ox/src/ox/model/typestore.hpp @@ -49,19 +49,9 @@ class TypeStore { constexpr DescriptorType *getInit(const auto &typeName, int typeVersion) noexcept { const auto typeId = buildTypeId(typeName, typeVersion); - auto [out, err] = m_cache.at(typeId); - if (err) { - out = &m_cache[typeId]; - *out = ox::make_unique(typeName, typeVersion); - return out->get(); - } - return out->get(); - } - - template - constexpr DescriptorType *getInit() noexcept { - constexpr auto name = requireModelTypeName(); - return getInit(name); + auto &out = m_cache[typeId]; + out = ox::make_unique(typeName, typeVersion); + return out.get(); } constexpr Result getLoad(const auto &typeName, auto typeVersion) noexcept {