noexcept-ness review (close #362)
This commit is contained in:
1
TODO
1
TODO
@@ -38,5 +38,4 @@
|
||||
* is it possible to make named type constraints namespace-free?
|
||||
* stomp -> merge (naming is hard as heck, it's known thing)
|
||||
* observer: user defined filters (eg .replace<T, &function> or .group<T, U, &func>)
|
||||
* review noexcept policy (there are some errores here and there)
|
||||
* use meta_handle for inputs to invoke/ctor/...
|
||||
|
||||
@@ -44,7 +44,7 @@ class identifier {
|
||||
using tuple_type = std::tuple<std::decay_t<Types>...>;
|
||||
|
||||
template<typename Type, std::size_t... Indexes>
|
||||
static constexpr ENTT_ID_TYPE get(std::index_sequence<Indexes...>) ENTT_NOEXCEPT {
|
||||
static constexpr ENTT_ID_TYPE get(std::index_sequence<Indexes...>) {
|
||||
static_assert(std::disjunction_v<std::is_same<Type, Types>...>);
|
||||
return (0 + ... + (std::is_same_v<Type, std::tuple_element_t<Indexes, tuple_type>> ? ENTT_ID_TYPE(Indexes) : ENTT_ID_TYPE{}));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ struct basic_actor {
|
||||
* @param entity A valid entity identifier.
|
||||
* @param ref An instance of the registry class.
|
||||
*/
|
||||
explicit basic_actor(entity_type entity, registry_type &ref)
|
||||
explicit basic_actor(entity_type entity, registry_type &ref) ENTT_NOEXCEPT
|
||||
: entt{entity}, reg{&ref}
|
||||
{
|
||||
ENTT_ASSERT(ref.valid(entity));
|
||||
@@ -69,7 +69,7 @@ struct basic_actor {
|
||||
*
|
||||
* @param other The instance to move from.
|
||||
*/
|
||||
basic_actor(basic_actor &&other)
|
||||
basic_actor(basic_actor &&other) ENTT_NOEXCEPT
|
||||
: entt{other.entt}, reg{other.reg}
|
||||
{
|
||||
other.entt = null;
|
||||
@@ -85,7 +85,7 @@ struct basic_actor {
|
||||
* @param other The instance to move from.
|
||||
* @return This actor.
|
||||
*/
|
||||
basic_actor & operator=(basic_actor &&other) {
|
||||
basic_actor & operator=(basic_actor &&other) ENTT_NOEXCEPT {
|
||||
if(this != &other) {
|
||||
auto tmp{std::move(other)};
|
||||
std::swap(reg, tmp.reg);
|
||||
@@ -129,7 +129,7 @@ struct basic_actor {
|
||||
* @return True if the actor has all the components, false otherwise.
|
||||
*/
|
||||
template<typename... Component>
|
||||
bool has() const ENTT_NOEXCEPT {
|
||||
bool has() const {
|
||||
return (reg->template has<Component>(entt) && ...);
|
||||
}
|
||||
|
||||
@@ -139,13 +139,13 @@ struct basic_actor {
|
||||
* @return References to the components owned by the actor.
|
||||
*/
|
||||
template<typename... Component>
|
||||
decltype(auto) get() const ENTT_NOEXCEPT {
|
||||
decltype(auto) get() const {
|
||||
return std::as_const(*reg).template get<Component...>(entt);
|
||||
}
|
||||
|
||||
/*! @copydoc get */
|
||||
template<typename... Component>
|
||||
decltype(auto) get() ENTT_NOEXCEPT {
|
||||
decltype(auto) get() {
|
||||
return reg->template get<Component...>(entt);
|
||||
}
|
||||
|
||||
@@ -155,13 +155,13 @@ struct basic_actor {
|
||||
* @return Pointers to the components owned by the actor.
|
||||
*/
|
||||
template<typename... Component>
|
||||
auto try_get() const ENTT_NOEXCEPT {
|
||||
auto try_get() const {
|
||||
return std::as_const(*reg).template try_get<Component...>(entt);
|
||||
}
|
||||
|
||||
/*! @copydoc try_get */
|
||||
template<typename... Component>
|
||||
auto try_get() ENTT_NOEXCEPT {
|
||||
auto try_get() {
|
||||
return reg->template try_get<Component...>(entt);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ struct basic_actor {
|
||||
* @brief Checks if an actor refers to a valid entity or not.
|
||||
* @return True if the actor refers to a valid entity, false otherwise.
|
||||
*/
|
||||
explicit operator bool() const ENTT_NOEXCEPT {
|
||||
explicit operator bool() const {
|
||||
return reg && reg->valid(entt);
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
iterator_type find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
iterator_type find(const entity_type entt) const {
|
||||
const auto it = handler->find(entt);
|
||||
return it != end() && *it == entt ? it : end();
|
||||
}
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
* @param pos Position of the element to return.
|
||||
* @return The identifier that occupies the given position.
|
||||
*/
|
||||
entity_type operator[](const size_type pos) const ENTT_NOEXCEPT {
|
||||
entity_type operator[](const size_type pos) const {
|
||||
return begin()[pos];
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return True if the group contains the given entity, false otherwise.
|
||||
*/
|
||||
bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
bool contains(const entity_type entt) const {
|
||||
return find(entt) != end();
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ public:
|
||||
* @return The components assigned to the entity.
|
||||
*/
|
||||
template<typename... Component>
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entt) const ENTT_NOEXCEPT {
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entt) const {
|
||||
ENTT_ASSERT(contains(entt));
|
||||
|
||||
if constexpr(sizeof...(Component) == 1) {
|
||||
@@ -662,7 +662,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
iterator_type find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
iterator_type find(const entity_type entt) const {
|
||||
const auto it = std::get<0>(pools)->find(entt);
|
||||
return it != end() && it >= begin() && *it == entt ? it : end();
|
||||
}
|
||||
@@ -672,7 +672,7 @@ public:
|
||||
* @param pos Position of the element to return.
|
||||
* @return The identifier that occupies the given position.
|
||||
*/
|
||||
entity_type operator[](const size_type pos) const ENTT_NOEXCEPT {
|
||||
entity_type operator[](const size_type pos) const {
|
||||
return begin()[pos];
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return True if the group contains the given entity, false otherwise.
|
||||
*/
|
||||
bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
bool contains(const entity_type entt) const {
|
||||
return find(entt) != end();
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ public:
|
||||
* @return The components assigned to the entity.
|
||||
*/
|
||||
template<typename... Component>
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entt) const ENTT_NOEXCEPT {
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entt) const {
|
||||
ENTT_ASSERT(contains(entt));
|
||||
|
||||
if constexpr(sizeof...(Component) == 1) {
|
||||
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
using iterator_type = typename sparse_set<Entity>::iterator_type;
|
||||
|
||||
/*! @brief Default constructor. */
|
||||
basic_observer() ENTT_NOEXCEPT
|
||||
basic_observer()
|
||||
: target{}, release{}, view{}
|
||||
{}
|
||||
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
* @param reg A valid reference to a registry.
|
||||
*/
|
||||
template<typename... Matcher>
|
||||
basic_observer(basic_registry<entity_type> ®, basic_collector<Matcher...>) ENTT_NOEXCEPT
|
||||
basic_observer(basic_registry<entity_type> ®, basic_collector<Matcher...>)
|
||||
: target{®},
|
||||
release{},
|
||||
view{}
|
||||
@@ -383,7 +383,7 @@ public:
|
||||
}
|
||||
|
||||
/*! @brief Resets the underlying container. */
|
||||
void clear() {
|
||||
void clear() ENTT_NOEXCEPT {
|
||||
view.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ public:
|
||||
using size_type = std::size_t;
|
||||
|
||||
/*! @brief Default constructor. */
|
||||
basic_registry() ENTT_NOEXCEPT = default;
|
||||
basic_registry() = default;
|
||||
|
||||
/*! @brief Default move constructor. */
|
||||
basic_registry(basic_registry &&) = default;
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
* @return Number of existing components of the given type.
|
||||
*/
|
||||
template<typename Component>
|
||||
size_type size() const ENTT_NOEXCEPT {
|
||||
size_type size() const {
|
||||
return assure<Component>()->size();
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public:
|
||||
* @brief Returns the number of entities still in use.
|
||||
* @return Number of entities still in use.
|
||||
*/
|
||||
size_type alive() const ENTT_NOEXCEPT {
|
||||
size_type alive() const {
|
||||
auto sz = entities.size();
|
||||
auto curr = destroyed;
|
||||
|
||||
@@ -388,7 +388,7 @@ public:
|
||||
* @return Capacity of the pool of the given component.
|
||||
*/
|
||||
template<typename Component>
|
||||
size_type capacity() const ENTT_NOEXCEPT {
|
||||
size_type capacity() const {
|
||||
return assure<Component>()->capacity();
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ public:
|
||||
* empty, false otherwise.
|
||||
*/
|
||||
template<typename... Component>
|
||||
bool empty() const ENTT_NOEXCEPT {
|
||||
bool empty() const {
|
||||
if constexpr(sizeof...(Component) == 0) {
|
||||
return !alive();
|
||||
} else {
|
||||
@@ -449,13 +449,13 @@ public:
|
||||
* @return A pointer to the array of components of the given type.
|
||||
*/
|
||||
template<typename Component>
|
||||
const Component * raw() const ENTT_NOEXCEPT {
|
||||
const Component * raw() const {
|
||||
return assure<Component>()->raw();
|
||||
}
|
||||
|
||||
/*! @copydoc raw */
|
||||
template<typename Component>
|
||||
Component * raw() ENTT_NOEXCEPT {
|
||||
Component * raw() {
|
||||
return const_cast<Component *>(std::as_const(*this).template raw<Component>());
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ public:
|
||||
* @return A pointer to the array of entities.
|
||||
*/
|
||||
template<typename Component>
|
||||
const entity_type * data() const ENTT_NOEXCEPT {
|
||||
const entity_type * data() const {
|
||||
return assure<Component>()->data();
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ public:
|
||||
* @param entity An entity identifier, either valid or not.
|
||||
* @return True if the identifier is valid, false otherwise.
|
||||
*/
|
||||
bool valid(const entity_type entity) const ENTT_NOEXCEPT {
|
||||
bool valid(const entity_type entity) const {
|
||||
const auto pos = size_type(to_integer(entity) & traits_type::entity_mask);
|
||||
return (pos < entities.size() && entities[pos] == entity);
|
||||
}
|
||||
@@ -518,7 +518,7 @@ public:
|
||||
* @param entity A valid entity identifier.
|
||||
* @return Actual version for the given entity identifier.
|
||||
*/
|
||||
version_type current(const entity_type entity) const ENTT_NOEXCEPT {
|
||||
version_type current(const entity_type entity) const {
|
||||
const auto pos = size_type(to_integer(entity) & traits_type::entity_mask);
|
||||
ENTT_ASSERT(pos < entities.size());
|
||||
return version_type(to_integer(entities[pos]) >> traits_type::entity_shift);
|
||||
@@ -727,7 +727,7 @@ public:
|
||||
* @return True if the entity has all the components, false otherwise.
|
||||
*/
|
||||
template<typename... Component>
|
||||
bool has(const entity_type entity) const ENTT_NOEXCEPT {
|
||||
bool has(const entity_type entity) const {
|
||||
ENTT_ASSERT(valid(entity));
|
||||
return (assure<Component>()->has(entity) && ...);
|
||||
}
|
||||
@@ -759,7 +759,7 @@ public:
|
||||
|
||||
/*! @copydoc get */
|
||||
template<typename... Component>
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entity) ENTT_NOEXCEPT {
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entity) {
|
||||
ENTT_ASSERT(valid(entity));
|
||||
|
||||
if constexpr(sizeof...(Component) == 1) {
|
||||
@@ -794,7 +794,7 @@ public:
|
||||
* @return Reference to the component owned by the entity.
|
||||
*/
|
||||
template<typename Component, typename... Args>
|
||||
decltype(auto) get_or_assign(const entity_type entity, Args &&... args) ENTT_NOEXCEPT {
|
||||
decltype(auto) get_or_assign(const entity_type entity, Args &&... args) {
|
||||
ENTT_ASSERT(valid(entity));
|
||||
auto *cpool = assure<Component>();
|
||||
return cpool->has(entity) ? cpool->get(entity) : cpool->assign(*this, entity, std::forward<Args>(args)...);
|
||||
@@ -813,7 +813,7 @@ public:
|
||||
* @return Pointers to the components owned by the entity.
|
||||
*/
|
||||
template<typename... Component>
|
||||
auto try_get([[maybe_unused]] const entity_type entity) const ENTT_NOEXCEPT {
|
||||
auto try_get([[maybe_unused]] const entity_type entity) const {
|
||||
ENTT_ASSERT(valid(entity));
|
||||
|
||||
if constexpr(sizeof...(Component) == 1) {
|
||||
@@ -825,7 +825,7 @@ public:
|
||||
|
||||
/*! @copydoc try_get */
|
||||
template<typename... Component>
|
||||
auto try_get([[maybe_unused]] const entity_type entity) ENTT_NOEXCEPT {
|
||||
auto try_get([[maybe_unused]] const entity_type entity) {
|
||||
if constexpr(sizeof...(Component) == 1) {
|
||||
return (assure<Component>()->try_get(entity), ...);
|
||||
} else {
|
||||
@@ -1056,7 +1056,7 @@ public:
|
||||
* @return A temporary sink object.
|
||||
*/
|
||||
template<typename Component>
|
||||
auto on_construct() ENTT_NOEXCEPT {
|
||||
auto on_construct() {
|
||||
return assure<Component>()->on_construct();
|
||||
}
|
||||
|
||||
@@ -1087,7 +1087,7 @@ public:
|
||||
* @return A temporary sink object.
|
||||
*/
|
||||
template<typename Component>
|
||||
auto on_replace() ENTT_NOEXCEPT {
|
||||
auto on_replace() {
|
||||
return assure<Component>()->on_replace();
|
||||
}
|
||||
|
||||
@@ -1119,7 +1119,7 @@ public:
|
||||
* @return A temporary sink object.
|
||||
*/
|
||||
template<typename Component>
|
||||
auto on_destroy() ENTT_NOEXCEPT {
|
||||
auto on_destroy() {
|
||||
return assure<Component>()->on_destroy();
|
||||
}
|
||||
|
||||
@@ -1271,7 +1271,7 @@ public:
|
||||
* otherwise.
|
||||
*/
|
||||
template<typename... Component>
|
||||
bool sortable() const ENTT_NOEXCEPT {
|
||||
bool sortable() const {
|
||||
return !(assure<Component>()->super || ...);
|
||||
}
|
||||
|
||||
@@ -1606,7 +1606,7 @@ public:
|
||||
*
|
||||
* @return A temporary object to use to take snasphosts.
|
||||
*/
|
||||
entt::basic_snapshot<Entity> snapshot() const ENTT_NOEXCEPT {
|
||||
entt::basic_snapshot<Entity> snapshot() const {
|
||||
using follow_fn_type = entity_type(const basic_registry &, const entity_type);
|
||||
|
||||
const auto head = to_integer(destroyed);
|
||||
@@ -1637,7 +1637,7 @@ public:
|
||||
*
|
||||
* @return A temporary object to use to load snasphosts.
|
||||
*/
|
||||
basic_snapshot_loader<Entity> loader() ENTT_NOEXCEPT {
|
||||
basic_snapshot_loader<Entity> loader() {
|
||||
using force_fn_type = void(basic_registry &, const entity_type, const bool);
|
||||
|
||||
force_fn_type *force = [](basic_registry ®, const entity_type entity, const bool discard) {
|
||||
@@ -1736,7 +1736,7 @@ public:
|
||||
* registry, a null pointer otherwise.
|
||||
*/
|
||||
template<typename Type>
|
||||
const Type * try_ctx() const ENTT_NOEXCEPT {
|
||||
const Type * try_ctx() const {
|
||||
const auto it = std::find_if(vars.begin(), vars.end(), [](const auto &var) {
|
||||
return var.runtime_type == runtime_type<Type, context_family>();
|
||||
});
|
||||
@@ -1746,7 +1746,7 @@ public:
|
||||
|
||||
/*! @copydoc try_ctx */
|
||||
template<typename Type>
|
||||
Type * try_ctx() ENTT_NOEXCEPT {
|
||||
Type * try_ctx() {
|
||||
return const_cast<Type *>(std::as_const(*this).template try_ctx<Type>());
|
||||
}
|
||||
|
||||
@@ -1763,7 +1763,7 @@ public:
|
||||
* @return A valid reference to the object in the context of the registry.
|
||||
*/
|
||||
template<typename Type>
|
||||
const Type & ctx() const ENTT_NOEXCEPT {
|
||||
const Type & ctx() const {
|
||||
const auto *instance = try_ctx<Type>();
|
||||
ENTT_ASSERT(instance);
|
||||
return *instance;
|
||||
@@ -1771,7 +1771,7 @@ public:
|
||||
|
||||
/*! @copydoc ctx */
|
||||
template<typename Type>
|
||||
Type & ctx() ENTT_NOEXCEPT {
|
||||
Type & ctx() {
|
||||
return const_cast<Type &>(std::as_const(*this).template ctx<Type>());
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class basic_runtime_view {
|
||||
}
|
||||
}
|
||||
|
||||
bool valid() const ENTT_NOEXCEPT {
|
||||
bool valid() const {
|
||||
return std::all_of(from, to, [entt = *begin](const auto *view) {
|
||||
return view->has(entt);
|
||||
});
|
||||
@@ -90,11 +90,11 @@ class basic_runtime_view {
|
||||
|
||||
iterator() ENTT_NOEXCEPT = default;
|
||||
|
||||
iterator & operator++() ENTT_NOEXCEPT {
|
||||
iterator & operator++() {
|
||||
return (++begin != end && !valid()) ? ++(*this) : *this;
|
||||
}
|
||||
|
||||
iterator operator++(int) ENTT_NOEXCEPT {
|
||||
iterator operator++(int) {
|
||||
iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
@@ -107,11 +107,11 @@ class basic_runtime_view {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
pointer operator->() const ENTT_NOEXCEPT {
|
||||
pointer operator->() const {
|
||||
return begin.operator->();
|
||||
}
|
||||
|
||||
reference operator*() const ENTT_NOEXCEPT {
|
||||
reference operator*() const {
|
||||
return *operator->();
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ class basic_runtime_view {
|
||||
std::rotate(pools.begin(), it, pools.end());
|
||||
}
|
||||
|
||||
bool valid() const ENTT_NOEXCEPT {
|
||||
bool valid() const {
|
||||
return !pools.empty() && pools.front();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
* @brief Estimates the number of entities that have the given components.
|
||||
* @return Estimated number of entities that have the given components.
|
||||
*/
|
||||
size_type size() const ENTT_NOEXCEPT {
|
||||
size_type size() const {
|
||||
return valid() ? pools.front()->size() : size_type{};
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
* @brief Checks if the view is definitely empty.
|
||||
* @return True if the view is definitely empty, false otherwise.
|
||||
*/
|
||||
bool empty() const ENTT_NOEXCEPT {
|
||||
bool empty() const {
|
||||
return !valid() || pools.front()->empty();
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity that has the given components.
|
||||
*/
|
||||
iterator_type begin() const ENTT_NOEXCEPT {
|
||||
iterator_type begin() const {
|
||||
iterator_type it{};
|
||||
|
||||
if(valid()) {
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity that has the
|
||||
* given components.
|
||||
*/
|
||||
iterator_type end() const ENTT_NOEXCEPT {
|
||||
iterator_type end() const {
|
||||
iterator_type it{};
|
||||
|
||||
if(valid()) {
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return True if the view contains the given entity, false otherwise.
|
||||
*/
|
||||
bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
bool contains(const entity_type entt) const {
|
||||
return valid() && std::all_of(pools.cbegin(), pools.cend(), [entt](const auto *view) {
|
||||
return view->find(entt) != view->end();
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ class sparse_set {
|
||||
return other.index - index;
|
||||
}
|
||||
|
||||
reference operator[](const difference_type value) const ENTT_NOEXCEPT {
|
||||
reference operator[](const difference_type value) const {
|
||||
const auto pos = size_type(index-value-1);
|
||||
return (*direct)[pos];
|
||||
}
|
||||
@@ -139,12 +139,12 @@ class sparse_set {
|
||||
return !(*this < other);
|
||||
}
|
||||
|
||||
pointer operator->() const ENTT_NOEXCEPT {
|
||||
pointer operator->() const {
|
||||
const auto pos = size_type(index-1);
|
||||
return &(*direct)[pos];
|
||||
}
|
||||
|
||||
reference operator*() const ENTT_NOEXCEPT {
|
||||
reference operator*() const {
|
||||
return *operator->();
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
sparse_set(sparse_set &&) = default;
|
||||
|
||||
/*! @brief Default destructor. */
|
||||
virtual ~sparse_set() ENTT_NOEXCEPT = default;
|
||||
virtual ~sparse_set() = default;
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
@@ -353,7 +353,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
iterator_type find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
iterator_type find(const entity_type entt) const {
|
||||
return has(entt) ? --(end() - index(entt)) : end();
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return True if the sparse set contains the entity, false otherwise.
|
||||
*/
|
||||
bool has(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
bool has(const entity_type entt) const {
|
||||
const auto curr = page(entt);
|
||||
// testing against null permits to avoid accessing the direct vector
|
||||
return (curr < reverse.size() && reverse[curr] && reverse[curr][offset(entt)] != null);
|
||||
@@ -380,7 +380,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return The position of the entity in the sparse set.
|
||||
*/
|
||||
size_type index(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
size_type index(const entity_type entt) const {
|
||||
ENTT_ASSERT(has(entt));
|
||||
return size_type(reverse[page(entt)][offset(entt)]);
|
||||
}
|
||||
@@ -461,7 +461,7 @@ public:
|
||||
* @param lhs A valid entity identifier.
|
||||
* @param rhs A valid entity identifier.
|
||||
*/
|
||||
virtual void swap(const entity_type lhs, const entity_type rhs) ENTT_NOEXCEPT {
|
||||
virtual void swap(const entity_type lhs, const entity_type rhs) {
|
||||
auto &from = reverse[page(lhs)][offset(lhs)];
|
||||
auto &to = reverse[page(rhs)][offset(rhs)];
|
||||
std::swap(direct[size_type(from)], direct[size_type(to)]);
|
||||
@@ -597,7 +597,7 @@ public:
|
||||
*
|
||||
* @param other The sparse sets that imposes the order of the entities.
|
||||
*/
|
||||
void respect(const sparse_set &other) ENTT_NOEXCEPT {
|
||||
void respect(const sparse_set &other) {
|
||||
const auto to = other.end();
|
||||
auto from = other.begin();
|
||||
|
||||
@@ -619,7 +619,7 @@ public:
|
||||
/**
|
||||
* @brief Resets a sparse set.
|
||||
*/
|
||||
void reset() {
|
||||
void reset() ENTT_NOEXCEPT {
|
||||
reverse.clear();
|
||||
direct.clear();
|
||||
}
|
||||
|
||||
@@ -278,12 +278,12 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return The object associated with the entity.
|
||||
*/
|
||||
const object_type & get(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
const object_type & get(const entity_type entt) const {
|
||||
return instances[underlying_type::index(entt)];
|
||||
}
|
||||
|
||||
/*! @copydoc get */
|
||||
object_type & get(const entity_type entt) ENTT_NOEXCEPT {
|
||||
object_type & get(const entity_type entt) {
|
||||
return const_cast<object_type &>(std::as_const(*this).get(entt));
|
||||
}
|
||||
|
||||
@@ -292,12 +292,12 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return The object associated with the entity, if any.
|
||||
*/
|
||||
const object_type * try_get(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
const object_type * try_get(const entity_type entt) const {
|
||||
return underlying_type::has(entt) ? (instances.data() + underlying_type::index(entt)) : nullptr;
|
||||
}
|
||||
|
||||
/*! @copydoc try_get */
|
||||
object_type * try_get(const entity_type entt) ENTT_NOEXCEPT {
|
||||
object_type * try_get(const entity_type entt) {
|
||||
return const_cast<object_type *>(std::as_const(*this).try_get(entt));
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ public:
|
||||
* @param lhs A valid entity identifier.
|
||||
* @param rhs A valid entity identifier.
|
||||
*/
|
||||
void swap(const entity_type lhs, const entity_type rhs) ENTT_NOEXCEPT override {
|
||||
void swap(const entity_type lhs, const entity_type rhs) override {
|
||||
std::swap(instances[underlying_type::index(lhs)], instances[underlying_type::index(rhs)]);
|
||||
underlying_type::swap(lhs, rhs);
|
||||
}
|
||||
@@ -655,7 +655,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return The object associated with the entity.
|
||||
*/
|
||||
object_type get([[maybe_unused]] const entity_type entt) const ENTT_NOEXCEPT {
|
||||
object_type get([[maybe_unused]] const entity_type entt) const {
|
||||
ENTT_ASSERT(underlying_type::has(entt));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
|
||||
}
|
||||
}
|
||||
|
||||
bool valid() const ENTT_NOEXCEPT {
|
||||
bool valid() const {
|
||||
return std::all_of(unchecked.cbegin(), unchecked.cend(), [this](const sparse_set<Entity> *view) { return view->has(*begin); })
|
||||
&& std::none_of(filter.cbegin(), filter.cend(), [this](const sparse_set<Entity> *view) { return view->has(*begin); });
|
||||
}
|
||||
@@ -110,11 +110,11 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
|
||||
|
||||
iterator() ENTT_NOEXCEPT = default;
|
||||
|
||||
iterator & operator++() ENTT_NOEXCEPT {
|
||||
iterator & operator++() {
|
||||
return (++begin != end && !valid()) ? ++(*this) : *this;
|
||||
}
|
||||
|
||||
iterator operator++(int) ENTT_NOEXCEPT {
|
||||
iterator operator++(int) {
|
||||
iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
@@ -127,11 +127,11 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
pointer operator->() const ENTT_NOEXCEPT {
|
||||
pointer operator->() const {
|
||||
return begin.operator->();
|
||||
}
|
||||
|
||||
reference operator*() const ENTT_NOEXCEPT {
|
||||
reference operator*() const {
|
||||
return *operator->();
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
|
||||
});
|
||||
}
|
||||
|
||||
unchecked_type unchecked(const sparse_set<Entity> *view) const ENTT_NOEXCEPT {
|
||||
unchecked_type unchecked(const sparse_set<Entity> *view) const {
|
||||
std::size_t pos{};
|
||||
unchecked_type other{};
|
||||
((std::get<pool_type<Component> *>(pools) == view ? nullptr : (other[pos++] = std::get<pool_type<Component> *>(pools))), ...);
|
||||
@@ -162,7 +162,7 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
|
||||
}
|
||||
|
||||
template<typename Comp, typename Other>
|
||||
decltype(auto) get([[maybe_unused]] component_iterator_type<Comp> it, [[maybe_unused]] pool_type<Other> *cpool, [[maybe_unused]] const Entity entt) const ENTT_NOEXCEPT {
|
||||
decltype(auto) get([[maybe_unused]] component_iterator_type<Comp> it, [[maybe_unused]] pool_type<Other> *cpool, [[maybe_unused]] const Entity entt) const {
|
||||
if constexpr(std::is_same_v<Comp, Other>) {
|
||||
return *it;
|
||||
} else {
|
||||
@@ -302,7 +302,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity that has the given components.
|
||||
*/
|
||||
iterator_type begin() const ENTT_NOEXCEPT {
|
||||
iterator_type begin() const {
|
||||
const auto *view = candidate();
|
||||
const filter_type ignore{std::get<pool_type<Exclude> *>(filter)...};
|
||||
return iterator_type{view->begin(), view->end(), unchecked(view), ignore};
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity that has the
|
||||
* given components.
|
||||
*/
|
||||
iterator_type end() const ENTT_NOEXCEPT {
|
||||
iterator_type end() const {
|
||||
const auto *view = candidate();
|
||||
const filter_type ignore{std::get<pool_type<Exclude> *>(filter)...};
|
||||
return iterator_type{view->end(), view->end(), unchecked(view), ignore};
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
iterator_type find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
iterator_type find(const entity_type entt) const {
|
||||
const auto *view = candidate();
|
||||
const filter_type ignore{std::get<pool_type<Exclude> *>(filter)...};
|
||||
iterator_type it{view->find(entt), view->end(), unchecked(view), ignore};
|
||||
@@ -347,7 +347,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return True if the view contains the given entity, false otherwise.
|
||||
*/
|
||||
bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
bool contains(const entity_type entt) const {
|
||||
return find(entt) != end();
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ public:
|
||||
* @return The components assigned to the entity.
|
||||
*/
|
||||
template<typename... Comp>
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entt) const ENTT_NOEXCEPT {
|
||||
decltype(auto) get([[maybe_unused]] const entity_type entt) const {
|
||||
ENTT_ASSERT(contains(entt));
|
||||
|
||||
if constexpr(sizeof...(Comp) == 0) {
|
||||
@@ -658,7 +658,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
iterator_type find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
iterator_type find(const entity_type entt) const {
|
||||
const auto it = pool->find(entt);
|
||||
return it != end() && *it == entt ? it : end();
|
||||
}
|
||||
@@ -668,7 +668,7 @@ public:
|
||||
* @param pos Position of the element to return.
|
||||
* @return The identifier that occupies the given position.
|
||||
*/
|
||||
entity_type operator[](const size_type pos) const ENTT_NOEXCEPT {
|
||||
entity_type operator[](const size_type pos) const {
|
||||
return begin()[pos];
|
||||
}
|
||||
|
||||
@@ -677,7 +677,7 @@ public:
|
||||
* @param entt A valid entity identifier.
|
||||
* @return True if the view contains the given entity, false otherwise.
|
||||
*/
|
||||
bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
bool contains(const entity_type entt) const {
|
||||
return find(entt) != end();
|
||||
}
|
||||
|
||||
@@ -697,7 +697,7 @@ public:
|
||||
* @return The component assigned to the entity.
|
||||
*/
|
||||
template<typename Comp = Component>
|
||||
decltype(auto) get(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
decltype(auto) get(const entity_type entt) const {
|
||||
static_assert(std::is_same_v<Comp, Component>);
|
||||
ENTT_ASSERT(contains(entt));
|
||||
return pool->get(entt);
|
||||
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
* @brief Constructs an extended factory from a given node.
|
||||
* @param target The underlying node to which to assign the properties.
|
||||
*/
|
||||
meta_factory(entt::internal::meta_prop_node **target)
|
||||
meta_factory(entt::internal::meta_prop_node **target) ENTT_NOEXCEPT
|
||||
: curr{target}
|
||||
{}
|
||||
|
||||
@@ -851,7 +851,7 @@ inline meta_type resolve(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
|
||||
*/
|
||||
template<typename Op>
|
||||
inline std::enable_if_t<std::is_invocable_v<Op, meta_type>, void>
|
||||
resolve(Op op) ENTT_NOEXCEPT {
|
||||
resolve(Op op) {
|
||||
internal::visit<meta_type>(std::move(op), *internal::meta_info<>::global);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ struct meta_type_node {
|
||||
|
||||
|
||||
template<typename Type, typename Op, typename Node>
|
||||
void visit(Op op, Node *node) ENTT_NOEXCEPT {
|
||||
void visit(Op op, Node *node) {
|
||||
while(node) {
|
||||
op(Type{node});
|
||||
node = node->next;
|
||||
@@ -138,7 +138,7 @@ void visit(Op op, Node *node) ENTT_NOEXCEPT {
|
||||
|
||||
|
||||
template<auto Member, typename Type, typename Op>
|
||||
void visit(Op op, const internal::meta_type_node *node) ENTT_NOEXCEPT {
|
||||
void visit(Op op, const internal::meta_type_node *node) {
|
||||
if(node) {
|
||||
internal::visit<Type>(op, node->*Member);
|
||||
auto *next = node->base;
|
||||
@@ -152,7 +152,7 @@ void visit(Op op, const internal::meta_type_node *node) ENTT_NOEXCEPT {
|
||||
|
||||
|
||||
template<typename Op, typename Node>
|
||||
auto find_if(Op op, Node *node) ENTT_NOEXCEPT {
|
||||
auto find_if(Op op, Node *node) {
|
||||
while(node && !op(node)) {
|
||||
node = node->next;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ auto find_if(Op op, Node *node) ENTT_NOEXCEPT {
|
||||
|
||||
|
||||
template<auto Member, typename Op>
|
||||
auto find_if(Op op, const meta_type_node *node) ENTT_NOEXCEPT
|
||||
auto find_if(Op op, const meta_type_node *node)
|
||||
-> decltype(find_if(op, node->*Member)) {
|
||||
decltype(find_if(op, node->*Member)) ret = nullptr;
|
||||
|
||||
@@ -439,7 +439,7 @@ public:
|
||||
*
|
||||
* @param other The instance to move from.
|
||||
*/
|
||||
meta_any(meta_any &&other) ENTT_NOEXCEPT
|
||||
meta_any(meta_any &&other)
|
||||
: meta_any{}
|
||||
{
|
||||
swap(*this, other);
|
||||
@@ -477,7 +477,7 @@ public:
|
||||
* @param other The instance to assign.
|
||||
* @return This meta any object.
|
||||
*/
|
||||
meta_any & operator=(meta_any &&other) ENTT_NOEXCEPT {
|
||||
meta_any & operator=(meta_any &&other) {
|
||||
meta_any any{std::move(other)};
|
||||
swap(any, *this);
|
||||
return *this;
|
||||
@@ -508,7 +508,7 @@ public:
|
||||
* @return A (possibly null) pointer to the contained instance.
|
||||
*/
|
||||
template<typename Type>
|
||||
const Type * try_cast() const ENTT_NOEXCEPT {
|
||||
const Type * try_cast() const {
|
||||
void *ret = nullptr;
|
||||
|
||||
if(const auto * const type = internal::meta_info<Type>::resolve(); type == node) {
|
||||
@@ -522,7 +522,7 @@ public:
|
||||
|
||||
/*! @copydoc try_cast */
|
||||
template<typename Type>
|
||||
Type * try_cast() ENTT_NOEXCEPT {
|
||||
Type * try_cast() {
|
||||
return const_cast<Type *>(std::as_const(*this).try_cast<Type>());
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ public:
|
||||
* @return A reference to the contained instance.
|
||||
*/
|
||||
template<typename Type>
|
||||
const Type & cast() const ENTT_NOEXCEPT {
|
||||
const Type & cast() const {
|
||||
auto * const actual = try_cast<Type>();
|
||||
ENTT_ASSERT(actual);
|
||||
return *actual;
|
||||
@@ -549,7 +549,7 @@ public:
|
||||
|
||||
/*! @copydoc cast */
|
||||
template<typename Type>
|
||||
Type & cast() ENTT_NOEXCEPT {
|
||||
Type & cast() {
|
||||
return const_cast<Type &>(std::as_const(*this).cast<Type>());
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ public:
|
||||
* @return False if the two containers differ in their content, true
|
||||
* otherwise.
|
||||
*/
|
||||
bool operator==(const meta_any &other) const ENTT_NOEXCEPT {
|
||||
bool operator==(const meta_any &other) const {
|
||||
return node == other.node && (!node || node->compare(instance, other.instance));
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ public:
|
||||
* @param lhs A valid meta any object.
|
||||
* @param rhs A valid meta any object.
|
||||
*/
|
||||
friend void swap(meta_any &lhs, meta_any &rhs) ENTT_NOEXCEPT {
|
||||
friend void swap(meta_any &lhs, meta_any &rhs) {
|
||||
if(lhs.steal_fn && rhs.steal_fn) {
|
||||
meta_any buffer{};
|
||||
lhs.steal_fn(buffer, lhs);
|
||||
@@ -743,7 +743,7 @@ struct meta_prop {
|
||||
* @brief Returns the stored key.
|
||||
* @return A meta any containing the key stored with the given property.
|
||||
*/
|
||||
meta_any key() const ENTT_NOEXCEPT {
|
||||
meta_any key() const {
|
||||
return node->key();
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ struct meta_prop {
|
||||
* @brief Returns the stored value.
|
||||
* @return A meta any containing the value stored with the given property.
|
||||
*/
|
||||
meta_any value() const ENTT_NOEXCEPT {
|
||||
meta_any value() const {
|
||||
return node->value();
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ struct meta_conv {
|
||||
* @param instance The instance to convert.
|
||||
* @return An opaque pointer to the instance to convert.
|
||||
*/
|
||||
meta_any convert(const void *instance) const ENTT_NOEXCEPT {
|
||||
meta_any convert(const void *instance) const {
|
||||
return node->conv(instance);
|
||||
}
|
||||
|
||||
@@ -936,7 +936,7 @@ struct meta_ctor {
|
||||
*/
|
||||
template<typename Op>
|
||||
std::enable_if_t<std::is_invocable_v<Op, meta_prop>, void>
|
||||
prop(Op op) const ENTT_NOEXCEPT {
|
||||
prop(Op op) const {
|
||||
internal::visit<meta_prop>(std::move(op), node->prop);
|
||||
}
|
||||
|
||||
@@ -945,7 +945,7 @@ struct meta_ctor {
|
||||
* @param key The key to use to search for a property.
|
||||
* @return The property associated with the given key, if any.
|
||||
*/
|
||||
meta_prop prop(meta_any key) const ENTT_NOEXCEPT {
|
||||
meta_prop prop(meta_any key) const {
|
||||
return internal::find_if([key = std::move(key)](const auto *curr) {
|
||||
return curr->key() == key;
|
||||
}, node->prop);
|
||||
@@ -1106,7 +1106,7 @@ struct meta_data {
|
||||
* @param handle An opaque pointer to an instance of the underlying type.
|
||||
* @return A meta any containing the value of the underlying variable.
|
||||
*/
|
||||
meta_any get(meta_handle handle) const ENTT_NOEXCEPT {
|
||||
meta_any get(meta_handle handle) const {
|
||||
return node->get(handle, meta_any{});
|
||||
}
|
||||
|
||||
@@ -1120,7 +1120,7 @@ struct meta_data {
|
||||
* @param index Position of the underlying element to get.
|
||||
* @return A meta any containing the value of the underlying element.
|
||||
*/
|
||||
meta_any get(meta_handle handle, std::size_t index) const ENTT_NOEXCEPT {
|
||||
meta_any get(meta_handle handle, std::size_t index) const {
|
||||
ENTT_ASSERT(index < node->type()->extent);
|
||||
return node->get(handle, index);
|
||||
}
|
||||
@@ -1132,7 +1132,7 @@ struct meta_data {
|
||||
*/
|
||||
template<typename Op>
|
||||
std::enable_if_t<std::is_invocable_v<Op, meta_prop>, void>
|
||||
prop(Op op) const ENTT_NOEXCEPT {
|
||||
prop(Op op) const {
|
||||
internal::visit<meta_prop>(std::move(op), node->prop);
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,7 @@ struct meta_data {
|
||||
* @param key The key to use to search for a property.
|
||||
* @return The property associated with the given key, if any.
|
||||
*/
|
||||
meta_prop prop(meta_any key) const ENTT_NOEXCEPT {
|
||||
meta_prop prop(meta_any key) const {
|
||||
return internal::find_if([key = std::move(key)](const auto *curr) {
|
||||
return curr->key() == key;
|
||||
}, node->prop);
|
||||
@@ -1255,7 +1255,7 @@ struct meta_func {
|
||||
*/
|
||||
template<typename Op>
|
||||
std::enable_if_t<std::is_invocable_v<Op, meta_prop>, void>
|
||||
prop(Op op) const ENTT_NOEXCEPT {
|
||||
prop(Op op) const {
|
||||
internal::visit<meta_prop>(std::move(op), node->prop);
|
||||
}
|
||||
|
||||
@@ -1264,7 +1264,7 @@ struct meta_func {
|
||||
* @param key The key to use to search for a property.
|
||||
* @return The property associated with the given key, if any.
|
||||
*/
|
||||
meta_prop prop(meta_any key) const ENTT_NOEXCEPT {
|
||||
meta_prop prop(meta_any key) const {
|
||||
return internal::find_if([key = std::move(key)](const auto *curr) {
|
||||
return curr->key() == key;
|
||||
}, node->prop);
|
||||
@@ -1297,7 +1297,7 @@ inline bool operator!=(const meta_func &lhs, const meta_func &rhs) ENTT_NOEXCEPT
|
||||
/*! @brief Opaque container for meta types. */
|
||||
class meta_type {
|
||||
template<typename... Args, std::size_t... Indexes>
|
||||
auto ctor(std::index_sequence<Indexes...>) const ENTT_NOEXCEPT {
|
||||
auto ctor(std::index_sequence<Indexes...>) const {
|
||||
return internal::find_if([](const auto *candidate) {
|
||||
return candidate->size == sizeof...(Args) && ([](auto *from, auto *to) {
|
||||
return (from == to) || internal::find_if<&internal::meta_type_node::base>([to](const auto *curr) { return curr->type() == to; }, from)
|
||||
@@ -1456,7 +1456,7 @@ public:
|
||||
*/
|
||||
template<typename Op>
|
||||
std::enable_if_t<std::is_invocable_v<Op, meta_base>, void>
|
||||
base(Op op) const ENTT_NOEXCEPT {
|
||||
base(Op op) const {
|
||||
internal::visit<&internal::meta_type_node::base, meta_base>(std::move(op), node);
|
||||
}
|
||||
|
||||
@@ -1465,7 +1465,7 @@ public:
|
||||
* @param identifier Unique identifier.
|
||||
* @return The meta base associated with the given identifier, if any.
|
||||
*/
|
||||
meta_base base(const ENTT_ID_TYPE identifier) const ENTT_NOEXCEPT {
|
||||
meta_base base(const ENTT_ID_TYPE identifier) const {
|
||||
return internal::find_if<&internal::meta_type_node::base>([identifier](const auto *curr) {
|
||||
return curr->type()->identifier == identifier;
|
||||
}, node);
|
||||
@@ -1477,7 +1477,7 @@ public:
|
||||
* @param op A valid function object.
|
||||
*/
|
||||
template<typename Op>
|
||||
void conv(Op op) const ENTT_NOEXCEPT {
|
||||
void conv(Op op) const {
|
||||
internal::visit<&internal::meta_type_node::conv, meta_conv>(std::move(op), node);
|
||||
}
|
||||
|
||||
@@ -1488,7 +1488,7 @@ public:
|
||||
* any.
|
||||
*/
|
||||
template<typename Type>
|
||||
meta_conv conv() const ENTT_NOEXCEPT {
|
||||
meta_conv conv() const {
|
||||
return internal::find_if<&internal::meta_type_node::conv>([type = internal::meta_info<Type>::resolve()](const auto *curr) {
|
||||
return curr->type() == type;
|
||||
}, node);
|
||||
@@ -1500,7 +1500,7 @@ public:
|
||||
* @param op A valid function object.
|
||||
*/
|
||||
template<typename Op>
|
||||
void ctor(Op op) const ENTT_NOEXCEPT {
|
||||
void ctor(Op op) const {
|
||||
internal::visit<meta_ctor>(std::move(op), node->ctor);
|
||||
}
|
||||
|
||||
@@ -1510,7 +1510,7 @@ public:
|
||||
* @return The requested meta constructor, if any.
|
||||
*/
|
||||
template<typename... Args>
|
||||
meta_ctor ctor() const ENTT_NOEXCEPT {
|
||||
meta_ctor ctor() const {
|
||||
return ctor<Args...>(std::index_sequence_for<Args...>{});
|
||||
}
|
||||
|
||||
@@ -1532,7 +1532,7 @@ public:
|
||||
*/
|
||||
template<typename Op>
|
||||
std::enable_if_t<std::is_invocable_v<Op, meta_data>, void>
|
||||
data(Op op) const ENTT_NOEXCEPT {
|
||||
data(Op op) const {
|
||||
internal::visit<&internal::meta_type_node::data, meta_data>(std::move(op), node);
|
||||
}
|
||||
|
||||
@@ -1544,7 +1544,7 @@ public:
|
||||
* @param identifier Unique identifier.
|
||||
* @return The meta data associated with the given identifier, if any.
|
||||
*/
|
||||
meta_data data(const ENTT_ID_TYPE identifier) const ENTT_NOEXCEPT {
|
||||
meta_data data(const ENTT_ID_TYPE identifier) const {
|
||||
return internal::find_if<&internal::meta_type_node::data>([identifier](const auto *curr) {
|
||||
return curr->identifier == identifier;
|
||||
}, node);
|
||||
@@ -1560,7 +1560,7 @@ public:
|
||||
*/
|
||||
template<typename Op>
|
||||
std::enable_if_t<std::is_invocable_v<Op, meta_func>, void>
|
||||
func(Op op) const ENTT_NOEXCEPT {
|
||||
func(Op op) const {
|
||||
internal::visit<&internal::meta_type_node::func, meta_func>(std::move(op), node);
|
||||
}
|
||||
|
||||
@@ -1572,7 +1572,7 @@ public:
|
||||
* @param identifier Unique identifier.
|
||||
* @return The meta function associated with the given identifier, if any.
|
||||
*/
|
||||
meta_func func(const ENTT_ID_TYPE identifier) const ENTT_NOEXCEPT {
|
||||
meta_func func(const ENTT_ID_TYPE identifier) const {
|
||||
return internal::find_if<&internal::meta_type_node::func>([identifier](const auto *curr) {
|
||||
return curr->identifier == identifier;
|
||||
}, node);
|
||||
@@ -1631,7 +1631,7 @@ public:
|
||||
*/
|
||||
template<typename Op>
|
||||
std::enable_if_t<std::is_invocable_v<Op, meta_prop>, void>
|
||||
prop(Op op) const ENTT_NOEXCEPT {
|
||||
prop(Op op) const {
|
||||
internal::visit<&internal::meta_type_node::prop, meta_prop>(std::move(op), node);
|
||||
}
|
||||
|
||||
@@ -1643,7 +1643,7 @@ public:
|
||||
* @param key The key to use to search for a property.
|
||||
* @return The property associated with the given key, if any.
|
||||
*/
|
||||
meta_prop prop(meta_any key) const ENTT_NOEXCEPT {
|
||||
meta_prop prop(meta_any key) const {
|
||||
return internal::find_if<&internal::meta_type_node::prop>([key = std::move(key)](const auto *curr) {
|
||||
return curr->key() == key;
|
||||
}, node);
|
||||
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
using delta_type = Delta;
|
||||
|
||||
/*! @brief Default destructor. */
|
||||
virtual ~process() ENTT_NOEXCEPT {
|
||||
virtual ~process() {
|
||||
static_assert(std::is_base_of_v<process, Derived>);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
*
|
||||
* @param immediately Requests an immediate operation.
|
||||
*/
|
||||
void abort(const bool immediately = false) ENTT_NOEXCEPT {
|
||||
void abort(const bool immediately = false) {
|
||||
if(alive()) {
|
||||
current = state::ABORTED;
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
using size_type = std::size_t;
|
||||
|
||||
/*! @brief Default constructor. */
|
||||
scheduler() ENTT_NOEXCEPT = default;
|
||||
scheduler() = default;
|
||||
|
||||
/*! @brief Default move constructor. */
|
||||
scheduler(scheduler &&) = default;
|
||||
|
||||
@@ -176,7 +176,7 @@ struct cache {
|
||||
* @param id Unique resource identifier.
|
||||
* @return True if the cache contains the resource, false otherwise.
|
||||
*/
|
||||
bool contains(const id_type id) const ENTT_NOEXCEPT {
|
||||
bool contains(const id_type id) const {
|
||||
return (resources.find(id) != resources.cend());
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ struct cache {
|
||||
*
|
||||
* @param id Unique resource identifier.
|
||||
*/
|
||||
void discard(const id_type id) ENTT_NOEXCEPT {
|
||||
void discard(const id_type id) {
|
||||
if(auto it = resources.find(id); it != resources.end()) {
|
||||
resources.erase(it);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,9 @@ public:
|
||||
* @brief Returns true if a handle contains a resource, false otherwise.
|
||||
* @return True if the handle contains a resource, false otherwise.
|
||||
*/
|
||||
explicit operator bool() const { return static_cast<bool>(resource); }
|
||||
explicit operator bool() const ENTT_NOEXCEPT {
|
||||
return static_cast<bool>(resource);
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<Resource> resource;
|
||||
|
||||
@@ -39,7 +39,7 @@ class dispatcher {
|
||||
struct base_wrapper {
|
||||
virtual ~base_wrapper() = default;
|
||||
virtual void publish() = 0;
|
||||
virtual void clear() = 0;
|
||||
virtual void clear() ENTT_NOEXCEPT = 0;
|
||||
};
|
||||
|
||||
template<typename Event>
|
||||
@@ -57,7 +57,7 @@ class dispatcher {
|
||||
events.erase(events.cbegin(), events.cbegin()+length);
|
||||
}
|
||||
|
||||
void clear() override {
|
||||
void clear() ENTT_NOEXCEPT override {
|
||||
events.clear();
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
* @tparam Event Type of events to discard.
|
||||
*/
|
||||
template<typename... Event>
|
||||
void discard() {
|
||||
void discard() ENTT_NOEXCEPT {
|
||||
if constexpr(sizeof...(Event) == 0) {
|
||||
std::for_each(wrappers.begin(), wrappers.end(), [](auto &&wdata) {
|
||||
if(wdata.wrapper) {
|
||||
|
||||
@@ -81,7 +81,7 @@ class emitter {
|
||||
return on_list.emplace(on_list.cend(), false, std::move(listener));
|
||||
}
|
||||
|
||||
void erase(connection_type conn) ENTT_NOEXCEPT {
|
||||
void erase(connection_type conn) {
|
||||
conn->first = true;
|
||||
|
||||
if(!publishing) {
|
||||
@@ -130,7 +130,7 @@ class emitter {
|
||||
}
|
||||
|
||||
template<typename Event>
|
||||
event_handler<Event> * assure() const ENTT_NOEXCEPT {
|
||||
event_handler<Event> * assure() const {
|
||||
const auto htype = type<Event>();
|
||||
handler_data *hdata = nullptr;
|
||||
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
friend class emitter;
|
||||
|
||||
/*! @brief Default constructor. */
|
||||
connection() noexcept(noexcept(typename event_handler<Event>::connection_type{})) = default;
|
||||
connection() = default;
|
||||
|
||||
/**
|
||||
* @brief Creates a connection that wraps its underlying instance.
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
* @param conn A valid connection.
|
||||
*/
|
||||
template<typename Event>
|
||||
void erase(connection<Event> conn) ENTT_NOEXCEPT {
|
||||
void erase(connection<Event> conn) {
|
||||
assure<Event>()->erase(std::move(conn));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user