Browse Source

any: rename local variable to make it easier for me to read too :)

Michele Caini 4 years ago
parent
commit
3fe584d366
1 changed files with 13 additions and 13 deletions
  1. 13 13
      src/entt/core/any.hpp

+ 13 - 13
src/entt/core/any.hpp

@@ -45,57 +45,57 @@ class basic_any {
     template<typename Type>
     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<Type, void> && std::is_same_v<std::remove_reference_t<std::remove_const_t<Type>>, Type>, "Invalid type");
-        const Type *instance = nullptr;
+        const Type *element = nullptr;
 
         if constexpr(in_situ<Type>) {
-            instance = (value.mode == policy::owner) ? ENTT_LAUNDER(reinterpret_cast<const Type *>(&value.storage)) : static_cast<const Type *>(value.instance);
+            element = (value.mode == policy::owner) ? ENTT_LAUNDER(reinterpret_cast<const Type *>(&value.storage)) : static_cast<const Type *>(value.instance);
         } else {
-            instance = static_cast<const Type *>(value.instance);
+            element = static_cast<const Type *>(value.instance);
         }
 
         switch(op) {
         case operation::copy:
             if constexpr(std::is_copy_constructible_v<Type>) {
-                static_cast<basic_any *>(const_cast<void *>(other))->initialize<Type>(*instance);
+                static_cast<basic_any *>(const_cast<void *>(other))->initialize<Type>(*element);
             }
             break;
         case operation::move:
             if constexpr(in_situ<Type>) {
                 if(value.mode == policy::owner) {
-                    return new(&static_cast<basic_any *>(const_cast<void *>(other))->storage) Type{std::move(*const_cast<Type *>(instance))};
+                    return new(&static_cast<basic_any *>(const_cast<void *>(other))->storage) Type{std::move(*const_cast<Type *>(element))};
                 }
             }
 
             return (static_cast<basic_any *>(const_cast<void *>(other))->instance = std::exchange(const_cast<basic_any &>(value).instance, nullptr));
         case operation::transfer:
             if constexpr(std::is_move_assignable_v<Type>) {
-                *const_cast<Type *>(instance) = std::move(*static_cast<Type *>(const_cast<void *>(other)));
+                *const_cast<Type *>(element) = std::move(*static_cast<Type *>(const_cast<void *>(other)));
                 return other;
             }
             [[fallthrough]];
         case operation::assign:
             if constexpr(std::is_copy_assignable_v<Type>) {
-                *const_cast<Type *>(instance) = *static_cast<const Type *>(other);
+                *const_cast<Type *>(element) = *static_cast<const Type *>(other);
                 return other;
             }
             break;
         case operation::destroy:
             if constexpr(in_situ<Type>) {
-                instance->~Type();
+                element->~Type();
             } else if constexpr(std::is_array_v<Type>) {
-                delete[] instance;
+                delete[] element;
             } else {
-                delete instance;
+                delete element;
             }
             break;
         case operation::compare:
             if constexpr(!std::is_function_v<Type> && !std::is_array_v<Type> && is_equality_comparable_v<Type>) {
-                return *static_cast<const Type *>(instance) == *static_cast<const Type *>(other) ? other : nullptr;
+                return *static_cast<const Type *>(element) == *static_cast<const Type *>(other) ? other : nullptr;
             } else {
-                return (instance == other) ? other : nullptr;
+                return (element == other) ? other : nullptr;
             }
         case operation::get:
-            return instance;
+            return element;
         }
 
         return nullptr;