diff --git a/src/entt/core/any.hpp b/src/entt/core/any.hpp index 6c2cce1b5..d6026b340 100644 --- a/src/entt/core/any.hpp +++ b/src/entt/core/any.hpp @@ -45,57 +45,57 @@ class basic_any { template static const void *basic_vtable([[maybe_unused]] const operation op, [[maybe_unused]] const basic_any &value, [[maybe_unused]] const void *other) { static_assert(!std::is_same_v && std::is_same_v>, Type>, "Invalid type"); - const Type *instance = nullptr; + const Type *element = nullptr; if constexpr(in_situ) { - instance = (value.mode == policy::owner) ? ENTT_LAUNDER(reinterpret_cast(&value.storage)) : static_cast(value.instance); + element = (value.mode == policy::owner) ? ENTT_LAUNDER(reinterpret_cast(&value.storage)) : static_cast(value.instance); } else { - instance = static_cast(value.instance); + element = static_cast(value.instance); } switch(op) { case operation::copy: if constexpr(std::is_copy_constructible_v) { - static_cast(const_cast(other))->initialize(*instance); + static_cast(const_cast(other))->initialize(*element); } break; case operation::move: if constexpr(in_situ) { if(value.mode == policy::owner) { - return new(&static_cast(const_cast(other))->storage) Type{std::move(*const_cast(instance))}; + return new(&static_cast(const_cast(other))->storage) Type{std::move(*const_cast(element))}; } } return (static_cast(const_cast(other))->instance = std::exchange(const_cast(value).instance, nullptr)); case operation::transfer: if constexpr(std::is_move_assignable_v) { - *const_cast(instance) = std::move(*static_cast(const_cast(other))); + *const_cast(element) = std::move(*static_cast(const_cast(other))); return other; } [[fallthrough]]; case operation::assign: if constexpr(std::is_copy_assignable_v) { - *const_cast(instance) = *static_cast(other); + *const_cast(element) = *static_cast(other); return other; } break; case operation::destroy: if constexpr(in_situ) { - instance->~Type(); + element->~Type(); } else if constexpr(std::is_array_v) { - delete[] instance; + delete[] element; } else { - delete instance; + delete element; } break; case operation::compare: if constexpr(!std::is_function_v && !std::is_array_v && is_equality_comparable_v) { - return *static_cast(instance) == *static_cast(other) ? other : nullptr; + return *static_cast(element) == *static_cast(other) ? other : nullptr; } else { - return (instance == other) ? other : nullptr; + return (element == other) ? other : nullptr; } case operation::get: - return instance; + return element; } return nullptr;