diff --git a/src/entt/meta/container.hpp b/src/entt/meta/container.hpp index 6f832d5ce..e1fe2befa 100644 --- a/src/entt/meta/container.hpp +++ b/src/entt/meta/container.hpp @@ -106,25 +106,28 @@ class basic_meta_sequence_container_traits { return true; case operation::insert: - case operation::erase: if constexpr(internal::dynamic_sequence_container::value) { auto *const non_const = any_cast(&it->base()); typename Type::const_iterator underlying{non_const ? *non_const : any_cast(it->base())}; - if(op == operation::insert) { - // this abomination is necessary because only on macos value_type and const_reference are different types for std::vector - if(auto &as_any = *static_cast(const_cast(cvalue)); as_any.allow_cast() || as_any.allow_cast()) { - const auto *element = as_any.try_cast>(); - it->rebind(static_cast(value)->insert(underlying, element ? *element : as_any.cast())); - return true; - } - } else { - it->rebind(static_cast(value)->erase(underlying)); + // this abomination is necessary because only on macos value_type and const_reference are different types for std::vector + if(auto &as_any = *static_cast(const_cast(cvalue)); as_any.allow_cast() || as_any.allow_cast()) { + const auto *element = as_any.try_cast>(); + it->rebind(static_cast(value)->insert(underlying, element ? *element : as_any.cast())); return true; } } break; + case operation::erase: + if constexpr(internal::dynamic_sequence_container::value) { + auto *const non_const = any_cast(&it->base()); + typename Type::const_iterator underlying{non_const ? *non_const : any_cast(it->base())}; + it->rebind(static_cast(value)->erase(underlying)); + return true; + } else { + break; + } } return false;