[ox/model] Make TypeStore::getInit always overwrite old value
This commit is contained in:
parent
b0faac199f
commit
bc98c42be6
16
deps/ox/src/ox/model/typestore.hpp
vendored
16
deps/ox/src/ox/model/typestore.hpp
vendored
@ -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<DescriptorType>(typeName, typeVersion);
|
||||
return out->get();
|
||||
}
|
||||
return out->get();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr DescriptorType *getInit() noexcept {
|
||||
constexpr auto name = requireModelTypeName<T>();
|
||||
return getInit(name);
|
||||
auto &out = m_cache[typeId];
|
||||
out = ox::make_unique<DescriptorType>(typeName, typeVersion);
|
||||
return out.get();
|
||||
}
|
||||
|
||||
constexpr Result<const DescriptorType*> getLoad(const auto &typeName, auto typeVersion) noexcept {
|
||||
|
Loading…
Reference in New Issue
Block a user