any: avoid else after return

This commit is contained in:
Michele Caini
2024-10-04 11:11:07 +02:00
parent f39c68793e
commit cc79817af3

View File

@@ -341,9 +341,9 @@ public:
if(vtable && mode != any_policy::cref && *info == *other.info) {
if(auto *val = other.data(); val) {
return (vtable(operation::transfer, *this, val) != nullptr);
} else {
return (vtable(operation::assign, *this, std::as_const(other).data()) != nullptr);
}
return (vtable(operation::assign, *this, std::as_const(other).data()) != nullptr);
}
return false;
@@ -453,9 +453,9 @@ template<typename Type, std::size_t Len, std::size_t Align>
if constexpr(std::is_copy_constructible_v<std::remove_cv_t<std::remove_reference_t<Type>>>) {
if(auto *const instance = any_cast<std::remove_reference_t<Type>>(&data); instance) {
return static_cast<Type>(std::move(*instance));
} else {
return any_cast<Type>(data);
}
return any_cast<Type>(data);
} else {
auto *const instance = any_cast<std::remove_reference_t<Type>>(&data);
ENTT_ASSERT(instance, "Invalid instance");