1 #ifndef ENTT_ENTITY_ENTITY_HPP
2 #define ENTT_ENTITY_ENTITY_HPP
7 #include "../config/config.h"
41 static constexpr std::uint16_t entity_mask = 0xFFF;
43 static constexpr std::uint16_t version_mask = 0xF;
45 static constexpr
auto entity_shift = 12;
67 static constexpr std::uint32_t entity_mask = 0xFFFFF;
69 static constexpr std::uint32_t version_mask = 0xFFF;
71 static constexpr
auto entity_shift = 20;
93 static constexpr std::uint64_t entity_mask = 0xFFFFFFFF;
95 static constexpr std::uint64_t version_mask = 0xFFFFFFFF;
97 static constexpr
auto entity_shift = 32;
111 template<
typename Entity>
115 template<
typename Entity>
116 constexpr
operator Entity()
const ENTT_NOEXCEPT {
117 return Entity{traits_type<Entity>::entity_mask};
120 constexpr
bool operator==(
null)
const ENTT_NOEXCEPT {
124 constexpr
bool operator!=(
null)
const ENTT_NOEXCEPT {
128 template<
typename Entity>
129 constexpr
bool operator==(
const Entity entity)
const ENTT_NOEXCEPT {
130 return (to_integer(entity) & traits_type<Entity>::entity_mask) == to_integer(static_cast<Entity>(*
this));
133 template<
typename Entity>
134 constexpr
bool operator!=(
const Entity entity)
const ENTT_NOEXCEPT {
135 return !(entity == *
this);
140 template<
typename Entity>
141 constexpr
bool operator==(
const Entity entity,
null other) ENTT_NOEXCEPT {
142 return other == entity;
146 template<
typename Entity>
147 constexpr
bool operator!=(
const Entity entity,
null other) ENTT_NOEXCEPT {
148 return other != entity;
168 constexpr
auto null = internal::null{};
174 #endif // ENTT_ENTITY_ENTITY_HPP