Fix warnings

This commit is contained in:
momo5502
2024-10-26 17:22:36 +02:00
parent b5765b2e0e
commit b9e1a0f01b

View File

@@ -285,19 +285,21 @@ namespace utils
{
return {};
}
const auto factory = this->factories_.find(std::type_index(typeid(T)));
if (factory == this->factories_.end())
else
{
throw std::runtime_error(
"Object construction failed. Missing factory for type: " + std::string(typeid(T).name()));
const auto factory = this->factories_.find(std::type_index(typeid(T)));
if (factory == this->factories_.end())
{
throw std::runtime_error(
"Object construction failed. Missing factory for type: " + std::string(typeid(T).name()));
}
auto* object = static_cast<T*>(factory->second());
auto obj = std::move(*object);
delete object;
return obj;
}
auto* object = static_cast<T*>(factory->second());
auto obj = std::move(*object);
delete object;
return obj;
}
};