[ox/model] Make TypeStore::getInit always overwrite old value

This commit is contained in:
Gary Talent 2022-08-13 20:42:06 -05:00
parent b0faac199f
commit bc98c42be6

View File

@ -49,19 +49,9 @@ class TypeStore {
constexpr DescriptorType *getInit(const auto &typeName, int typeVersion) noexcept { constexpr DescriptorType *getInit(const auto &typeName, int typeVersion) noexcept {
const auto typeId = buildTypeId(typeName, typeVersion); const auto typeId = buildTypeId(typeName, typeVersion);
auto [out, err] = m_cache.at(typeId); auto &out = m_cache[typeId];
if (err) { out = ox::make_unique<DescriptorType>(typeName, typeVersion);
out = &m_cache[typeId]; return out.get();
*out = ox::make_unique<DescriptorType>(typeName, typeVersion);
return out->get();
}
return out->get();
}
template<typename T>
constexpr DescriptorType *getInit() noexcept {
constexpr auto name = requireModelTypeName<T>();
return getInit(name);
} }
constexpr Result<const DescriptorType*> getLoad(const auto &typeName, auto typeVersion) noexcept { constexpr Result<const DescriptorType*> getLoad(const auto &typeName, auto typeVersion) noexcept {