Browse Source

entity: introduce the entity_like concept

skypjack 2 months ago
parent
commit
439265c486
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/entt/entity/fwd.hpp

+ 18 - 0
src/entt/entity/fwd.hpp

@@ -10,6 +10,24 @@
 
 
 namespace entt {
 namespace entt {
 
 
+/*! @cond TURN_OFF_DOXYGEN */
+namespace internal {
+
+template<typename>
+struct entt_traits;
+
+} // namespace internal
+/*! @endcond */
+
+/**
+ * @brief Specifies that a type is an entity-like type.
+ * @tparam Type Type to check.
+ */
+template<typename Type>
+concept entity_like = requires {
+    typename internal::entt_traits<Type>;
+};
+
 /*! @brief Default entity identifier. */
 /*! @brief Default entity identifier. */
 enum class entity : id_type {};
 enum class entity : id_type {};