Sfoglia il codice sorgente

meta: removed meta_type::is_union (no alternative provided)

Michele Caini 4 anni fa
parent
commit
adec4f08c6
3 ha cambiato i file con 1 aggiunte e 19 eliminazioni
  1. 0 8
      src/entt/meta/meta.hpp
  2. 0 2
      src/entt/meta/node.hpp
  3. 1 9
      test/entt/meta/meta_type.cpp

+ 0 - 8
src/entt/meta/meta.hpp

@@ -1131,14 +1131,6 @@ public:
         return !!(node->traits & internal::meta_traits::IS_ENUM);
     }
 
-    /**
-     * @brief Checks whether a type refers to an union or not.
-     * @return True if the underlying type is an union, false otherwise.
-     */
-    [[nodiscard]] bool is_union() const ENTT_NOEXCEPT {
-        return !!(node->traits & internal::meta_traits::IS_UNION);
-    }
-
     /**
      * @brief Checks whether a type refers to a class or not.
      * @return True if the underlying type is a class, false otherwise.

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

@@ -39,7 +39,6 @@ enum class meta_traits: std::uint32_t {
     IS_FLOATING_POINT = 0x0008,
     IS_ARRAY = 0x0010,
     IS_ENUM = 0x0020,
-    IS_UNION = 0x0040,
     IS_CLASS = 0x0080,
     IS_POINTER = 0x0100,
     IS_MEMBER_OBJECT_POINTER = 0x0200,
@@ -189,7 +188,6 @@ public:
                 | (std::is_floating_point_v<Type> ? internal::meta_traits::IS_FLOATING_POINT : internal::meta_traits::IS_NONE)
                 | (std::is_array_v<Type> ? internal::meta_traits::IS_ARRAY : internal::meta_traits::IS_NONE)
                 | (std::is_enum_v<Type> ? internal::meta_traits::IS_ENUM : internal::meta_traits::IS_NONE)
-                | (std::is_union_v<Type> ? internal::meta_traits::IS_UNION : internal::meta_traits::IS_NONE)
                 | (std::is_class_v<Type> ? internal::meta_traits::IS_CLASS : internal::meta_traits::IS_NONE)
                 | (std::is_pointer_v<Type> ? internal::meta_traits::IS_POINTER : internal::meta_traits::IS_NONE)
                 | (std::is_member_object_pointer_v<Type> ? internal::meta_traits::IS_MEMBER_OBJECT_POINTER : internal::meta_traits::IS_NONE)

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

@@ -87,11 +87,6 @@ enum class property_t {
     list
 };
 
-union union_t {
-    int i;
-    double d;
-};
-
 struct MetaType: ::testing::Test {
     void SetUp() override {
         using namespace entt::literals;
@@ -229,11 +224,8 @@ TEST_F(MetaType, Traits) {
     ASSERT_TRUE(entt::resolve<property_t>().is_enum());
     ASSERT_FALSE(entt::resolve<char>().is_enum());
 
-    ASSERT_TRUE(entt::resolve<union_t>().is_union());
-    ASSERT_FALSE(entt::resolve<derived_t>().is_union());
-
     ASSERT_TRUE(entt::resolve<derived_t>().is_class());
-    ASSERT_FALSE(entt::resolve<union_t>().is_class());
+    ASSERT_FALSE(entt::resolve<double>().is_class());
 
     ASSERT_TRUE(entt::resolve<int *>().is_pointer());
     ASSERT_FALSE(entt::resolve<int>().is_pointer());