Преглед изворни кода

any: use vtable instead of descriptor

skypjack пре 5 месеци
родитељ
комит
b4fc627c99
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      src/entt/core/any.hpp

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

@@ -439,7 +439,7 @@ public:
      * @return True in case of success, false otherwise.
      */
     bool assign(const basic_any &other) {
-        if(vtable && (mode != any_policy::cref) && ((descriptor == other.descriptor) || has_value(other.info()))) {
+        if(vtable && (mode != any_policy::cref) && ((vtable == other.vtable) || has_value(other.info()))) {
             return (vtable(request::assign, *this, other.data()) != nullptr);
         }
 
@@ -449,7 +449,7 @@ public:
     /*! @copydoc assign */
     // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
     bool assign(basic_any &&other) {
-        if(vtable && (mode != any_policy::cref) && ((descriptor == other.descriptor) || has_value(other.info()))) {
+        if(vtable && (mode != any_policy::cref) && ((vtable == other.vtable) || has_value(other.info()))) {
             if(auto *val = other.data(); val) {
                 return (vtable(request::transfer, *this, val) != nullptr);
             }
@@ -484,7 +484,7 @@ public:
      * @return False if the two objects differ in their content, true otherwise.
      */
     [[nodiscard]] bool operator==(const basic_any &other) const noexcept {
-        if(vtable && ((descriptor == other.descriptor) || has_value(other.info()))) {
+        if(vtable && ((vtable == other.vtable) || has_value(other.info()))) {
             return (vtable(request::compare, *this, other.data()) != nullptr);
         }