Add null ecs handle for convenience
This commit is contained in:
parent
5df29246a5
commit
403e24bf4c
1 changed files with 10 additions and 0 deletions
|
|
@ -14,6 +14,16 @@ namespace psemek::ecs
|
||||||
|
|
||||||
friend bool operator == (handle const &, handle const &) = default;
|
friend bool operator == (handle const &, handle const &) = default;
|
||||||
friend auto operator <=> (handle const &, handle const &) = default;
|
friend auto operator <=> (handle const &, handle const &) = default;
|
||||||
|
|
||||||
|
static handle null()
|
||||||
|
{
|
||||||
|
return {-1, -1};
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit operator bool() const
|
||||||
|
{
|
||||||
|
return (*this) != null();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream & operator << (std::ostream & out, handle const & handle)
|
inline std::ostream & operator << (std::ostream & out, handle const & handle)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue