#ifndef ENTT_ENTITY_COMPONENT_HPP #define ENTT_ENTITY_COMPONENT_HPP #include "../config/config.h" #include "../core/concepts.hpp" #include "../stl/concepts.hpp" #include "../stl/cstddef.hpp" #include "../stl/type_traits.hpp" #include "fwd.hpp" namespace entt { /*! @cond ENTT_INTERNAL */ namespace internal { template struct in_place_delete: stl::bool_constant && stl::is_move_assignable_v)> {}; template<> struct in_place_delete: stl::false_type {}; template requires Type::in_place_delete struct in_place_delete: stl::true_type {}; template struct page_size: stl::integral_constant * ENTT_PACKED_PAGE> {}; template<> struct page_size: stl::integral_constant {}; template requires stl::is_convertible_v struct page_size: stl::integral_constant {}; } // namespace internal /*! @endcond */ /** * @brief Common way to access various properties of components. * @tparam Type Element type. * @tparam Entity A valid entity type. */ template struct component_traits { /*! @brief Element type. */ using element_type = Type; /*! @brief Underlying entity identifier. */ using entity_type = Entity; /*! @brief Pointer stability, default is `false`. */ static constexpr bool in_place_delete = internal::in_place_delete::value; /*! @brief Page size, default is `ENTT_PACKED_PAGE` for non-empty types. */ static constexpr stl::size_t page_size = internal::page_size::value; }; } // namespace entt #endif