mirror of
https://github.com/BlackMATov/ecs.hpp.git
synced 2025-12-16 22:19:21 +07:00
less operator for entity and component
This commit is contained in:
30
ecs.hpp
30
ecs.hpp
@@ -718,6 +718,8 @@ namespace ecs_hpp
|
|||||||
entity_id id_{0u};
|
entity_id id_{0u};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool operator<(const entity& l, const entity& r) noexcept;
|
||||||
|
|
||||||
bool operator==(const entity& l, const entity& r) noexcept;
|
bool operator==(const entity& l, const entity& r) noexcept;
|
||||||
bool operator==(const entity& l, const const_entity& r) noexcept;
|
bool operator==(const entity& l, const const_entity& r) noexcept;
|
||||||
|
|
||||||
@@ -781,6 +783,8 @@ namespace ecs_hpp
|
|||||||
entity_id id_{0u};
|
entity_id id_{0u};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool operator<(const const_entity& l, const const_entity& r) noexcept;
|
||||||
|
|
||||||
bool operator==(const const_entity& l, const entity& r) noexcept;
|
bool operator==(const const_entity& l, const entity& r) noexcept;
|
||||||
bool operator==(const const_entity& l, const const_entity& r) noexcept;
|
bool operator==(const const_entity& l, const const_entity& r) noexcept;
|
||||||
|
|
||||||
@@ -836,6 +840,9 @@ namespace ecs_hpp
|
|||||||
entity owner_;
|
entity owner_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
bool operator<(const component<T>& l, const component<T>& r) noexcept;
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
bool operator==(const component<T>& l, const component<T>& r) noexcept;
|
bool operator==(const component<T>& l, const component<T>& r) noexcept;
|
||||||
template < typename T >
|
template < typename T >
|
||||||
@@ -886,6 +893,9 @@ namespace ecs_hpp
|
|||||||
const_entity owner_;
|
const_entity owner_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
bool operator<(const const_component<T>& l, const const_component<T>& r) noexcept;
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
bool operator==(const const_component<T>& l, const component<T>& r) noexcept;
|
bool operator==(const const_component<T>& l, const component<T>& r) noexcept;
|
||||||
template < typename T >
|
template < typename T >
|
||||||
@@ -1218,6 +1228,11 @@ namespace ecs_hpp
|
|||||||
return detail::as_const(*owner_).find_components<Ts...>(id_);
|
return detail::as_const(*owner_).find_components<Ts...>(id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool operator<(const entity& l, const entity& r) noexcept {
|
||||||
|
return (&l.owner() < &r.owner())
|
||||||
|
|| (&l.owner() == &r.owner() && l.id() < r.id());
|
||||||
|
}
|
||||||
|
|
||||||
inline bool operator==(const entity& l, const entity& r) noexcept {
|
inline bool operator==(const entity& l, const entity& r) noexcept {
|
||||||
return &l.owner() == &r.owner()
|
return &l.owner() == &r.owner()
|
||||||
&& l.id() == r.id();
|
&& l.id() == r.id();
|
||||||
@@ -1293,6 +1308,11 @@ namespace ecs_hpp
|
|||||||
return (*owner_).find_components<Ts...>(id_);
|
return (*owner_).find_components<Ts...>(id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool operator<(const const_entity& l, const const_entity& r) noexcept {
|
||||||
|
return (&l.owner() < &r.owner())
|
||||||
|
|| (&l.owner() == &r.owner() && l.id() < r.id());
|
||||||
|
}
|
||||||
|
|
||||||
inline bool operator==(const const_entity& l, const entity& r) noexcept {
|
inline bool operator==(const const_entity& l, const entity& r) noexcept {
|
||||||
return &l.owner() == &r.owner()
|
return &l.owner() == &r.owner()
|
||||||
&& l.id() == r.id();
|
&& l.id() == r.id();
|
||||||
@@ -1371,6 +1391,11 @@ namespace ecs_hpp
|
|||||||
return detail::as_const(owner_).template find_component<T>();
|
return detail::as_const(owner_).template find_component<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
bool operator<(const component<T>& l, const component<T>& r) noexcept {
|
||||||
|
return l.owner() < r.owner();
|
||||||
|
}
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
bool operator==(const component<T>& l, const component<T>& r) noexcept {
|
bool operator==(const component<T>& l, const component<T>& r) noexcept {
|
||||||
return l.owner() == r.owner();
|
return l.owner() == r.owner();
|
||||||
@@ -1428,6 +1453,11 @@ namespace ecs_hpp
|
|||||||
return detail::as_const(owner_).template find_component<T>();
|
return detail::as_const(owner_).template find_component<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
bool operator<(const const_component<T>& l, const const_component<T>& r) noexcept {
|
||||||
|
return l.owner() < r.owner();
|
||||||
|
}
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
bool operator==(const const_component<T>& l, const component<T>& r) noexcept {
|
bool operator==(const const_component<T>& l, const component<T>& r) noexcept {
|
||||||
return l.owner() == r.owner();
|
return l.owner() == r.owner();
|
||||||
|
|||||||
Reference in New Issue
Block a user