[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 {
|
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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user