1 #ifndef ENTT_ENTITY_ENTITY_HPP
2 #define ENTT_ENTITY_ENTITY_HPP
7 #include "../config/config.h"
8 #include "../core/type_traits.hpp"
42 static constexpr std::uint16_t entity_mask = 0xFFF;
44 static constexpr std::uint16_t version_mask = 0xF;
46 static constexpr
auto entity_shift = 12;
68 static constexpr std::uint32_t entity_mask = 0xFFFFF;
70 static constexpr std::uint32_t version_mask = 0xFFF;
72 static constexpr
auto entity_shift = 20;
94 static constexpr std::uint64_t entity_mask = 0xFFFFFFFF;
96 static constexpr std::uint64_t version_mask = 0xFFFFFFFF;
98 static constexpr
auto entity_shift = 32;
112 template<
typename Entity>
116 template<
typename Entity>
117 constexpr
operator Entity()
const ENTT_NOEXCEPT {
118 return Entity{traits_type<Entity>::entity_mask};
121 constexpr
bool operator==(
null)
const ENTT_NOEXCEPT {
125 constexpr
bool operator!=(
null)
const ENTT_NOEXCEPT {
129 template<
typename Entity>
130 constexpr
bool operator==(
const Entity entity)
const ENTT_NOEXCEPT {
131 return (to_integral(entity) & traits_type<Entity>::entity_mask) == to_integral(static_cast<Entity>(*
this));
134 template<
typename Entity>
135 constexpr
bool operator!=(
const Entity entity)
const ENTT_NOEXCEPT {
136 return !(entity == *
this);
141 template<
typename Entity>
142 constexpr
bool operator==(
const Entity entity,
null other) ENTT_NOEXCEPT {
143 return other == entity;
147 template<
typename Entity>
148 constexpr
bool operator!=(
const Entity entity,
null other) ENTT_NOEXCEPT {
149 return other != entity;
169 constexpr
auto null = internal::null{};