diff --git a/src/entt/meta/internal.hpp b/src/entt/meta/internal.hpp index 6d8c127e7..2307d7633 100644 --- a/src/entt/meta/internal.hpp +++ b/src/entt/meta/internal.hpp @@ -116,6 +116,7 @@ struct meta_type_node { const bool is_function_pointer; const bool is_member_object_pointer; const bool is_member_function_pointer; + const bool is_dereferenceable; const bool is_sequence_container; const bool is_associative_container; const size_type rank; @@ -259,6 +260,7 @@ public: std::is_pointer_v && std::is_function_v>, std::is_member_object_pointer_v, std::is_member_function_pointer_v, + is_dereferenceable_v, is_sequence_container_v, is_associative_container_v, std::rank_v, diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index e14cbd171..6b8339900 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -1415,6 +1415,14 @@ public: return node->is_member_function_pointer; } + /** + * @brief Checks whether a type is dereferenceable or not. + * @return True if the underlying type is dereferenceable, false otherwise. + */ + [[nodiscard]] bool is_dereferenceable() const ENTT_NOEXCEPT { + return node->is_dereferenceable; + } + /** * @brief Checks whether a type refers to a sequence container or not. * @return True if the underlying type is a sequence container, false diff --git a/test/entt/meta/meta_type.cpp b/test/entt/meta/meta_type.cpp index db58203ed..f7b79a4e9 100644 --- a/test/entt/meta/meta_type.cpp +++ b/test/entt/meta/meta_type.cpp @@ -1,5 +1,6 @@ -#include #include +#include +#include #include #include #include @@ -162,6 +163,10 @@ TEST_F(MetaType, Traits) { ASSERT_TRUE(entt::resolve().is_member_function_pointer()); ASSERT_FALSE(entt::resolve().is_member_function_pointer()); + ASSERT_TRUE(entt::resolve().is_dereferenceable()); + ASSERT_TRUE(entt::resolve>().is_dereferenceable()); + ASSERT_FALSE(entt::resolve().is_dereferenceable()); + ASSERT_TRUE(entt::resolve>().is_sequence_container()); ASSERT_FALSE((entt::resolve>().is_sequence_container()));