Browse Source

meta:
* updated meta_any::operator== to make it consistent across boundaries
* constness review for meta_type_node

Michele Caini 5 years ago
parent
commit
b04b966db1
3 changed files with 4 additions and 4 deletions
  1. 1 1
      src/entt/meta/meta.hpp
  2. 2 2
      src/entt/meta/node.hpp
  3. 1 1
      test/entt/meta/meta_type.cpp

+ 1 - 1
src/entt/meta/meta.hpp

@@ -509,7 +509,7 @@ public:
      * @return False if the two objects differ in their content, true otherwise.
      */
     [[nodiscard]] bool operator==(const meta_any &other) const {
-        return (node == other.node) && (storage == other.storage);
+        return (!node && !other.node) || (node && other.node && node->info == other.node->info && storage == other.storage);
     }
 
     /**

+ 2 - 2
src/entt/meta/node.hpp

@@ -132,12 +132,12 @@ struct meta_type_node {
     const bool is_pointer_like;
     const bool is_sequence_container;
     const bool is_associative_container;
-    meta_template_info template_info;
+    const meta_template_info template_info;
     const size_type rank;
     size_type(* const extent)(const size_type) ENTT_NOEXCEPT ;
     meta_type_node *(* const remove_pointer)() ENTT_NOEXCEPT;
     meta_type_node *(* const remove_extent)() ENTT_NOEXCEPT;
-    meta_ctor_node *def_ctor{nullptr};
+    meta_ctor_node * const def_ctor;
     meta_ctor_node *ctor{nullptr};
     meta_base_node *base{nullptr};
     meta_conv_node *conv{nullptr};

+ 1 - 1
test/entt/meta/meta_type.cpp

@@ -611,4 +611,4 @@ TEST_F(MetaType, ClassTemplate) {
     ASSERT_EQ(entt::resolve<std::shared_ptr<int>>().template_type(), entt::resolve<entt::meta_class_template_tag<std::shared_ptr>>());
     ASSERT_EQ(entt::resolve<std::shared_ptr<int>>().template_arg(0u), entt::resolve<int>());
     ASSERT_EQ(entt::resolve<std::shared_ptr<int>>().template_arg(1u), entt::meta_type{});
-}
+}