* review of entt_traits design
* added static constexpr member function entt_traits::to_integral
* added static constexpr member function entt_traits::to_entity
* added static constexpr member function entt_traits::to_version
* added static constexpr member function entt_traits::to_type
* custom class identifiers must expose member type entity_field
* it's no longer required to specialize entt_traits (breaking change)
This commit is contained in:
Michele Caini
2021-05-24 18:31:41 +02:00
parent 0b3e3fd19a
commit 3e7dc7af29
9 changed files with 134 additions and 85 deletions

View File

@@ -4,7 +4,7 @@
#include <entt/entity/registry.hpp>
struct entity_id {
using entity_type = typename entt::entt_traits<entt::entity>::entity_type;
using entity_type = std::uint32_t;
static constexpr auto null = entt::null;
constexpr entity_id(entity_type value = null)
@@ -23,9 +23,6 @@ private:
entity_type entt;
};
template<>
struct entt::entt_traits<entity_id>: entt::entt_traits<entt::entity> {};
TEST(Example, CustomIdentifier) {
entt::basic_registry<entity_id> registry{};
entity_id entity{};