entity: prepare to remove ENTT_NOEXCEPT[_IF]
This commit is contained in:
@@ -79,7 +79,7 @@ public:
|
||||
* @param value The value to convert.
|
||||
* @return The integral representation of the given value.
|
||||
*/
|
||||
[[nodiscard]] static constexpr entity_type to_integral(const value_type value) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] static constexpr entity_type to_integral(const value_type value) noexcept {
|
||||
return static_cast<entity_type>(value);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
* @param value The value to convert.
|
||||
* @return The integral representation of the entity part.
|
||||
*/
|
||||
[[nodiscard]] static constexpr entity_type to_entity(const value_type value) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] static constexpr entity_type to_entity(const value_type value) noexcept {
|
||||
return (to_integral(value) & base_type::entity_mask);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
* @param value The value to convert.
|
||||
* @return The integral representation of the version part.
|
||||
*/
|
||||
[[nodiscard]] static constexpr version_type to_version(const value_type value) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] static constexpr version_type to_version(const value_type value) noexcept {
|
||||
return (to_integral(value) >> base_type::entity_shift);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
* @param version The version part of the identifier.
|
||||
* @return A properly constructed identifier.
|
||||
*/
|
||||
[[nodiscard]] static constexpr value_type construct(const entity_type entity, const version_type version) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] static constexpr value_type construct(const entity_type entity, const version_type version) noexcept {
|
||||
return value_type{(entity & base_type::entity_mask) | (static_cast<entity_type>(version) << base_type::entity_shift)};
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
* @param rhs The identifier from which to take the version part.
|
||||
* @return A properly constructed identifier.
|
||||
*/
|
||||
[[nodiscard]] static constexpr value_type combine(const entity_type lhs, const entity_type rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] static constexpr value_type combine(const entity_type lhs, const entity_type rhs) noexcept {
|
||||
constexpr auto mask = (base_type::version_mask << base_type::entity_shift);
|
||||
return value_type{(lhs & base_type::entity_mask) | (rhs & mask)};
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
* @tparam Entity The value type.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr typename entt_traits<Entity>::entity_type to_integral(const Entity value) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr typename entt_traits<Entity>::entity_type to_integral(const Entity value) noexcept {
|
||||
return entt_traits<Entity>::to_integral(value);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ template<typename Entity>
|
||||
* @tparam Entity The value type.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr typename entt_traits<Entity>::entity_type to_entity(const Entity value) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr typename entt_traits<Entity>::entity_type to_entity(const Entity value) noexcept {
|
||||
return entt_traits<Entity>::to_entity(value);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ template<typename Entity>
|
||||
* @tparam Entity The value type.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr typename entt_traits<Entity>::version_type to_version(const Entity value) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr typename entt_traits<Entity>::version_type to_version(const Entity value) noexcept {
|
||||
return entt_traits<Entity>::to_version(value);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ struct null_t {
|
||||
* @return The null representation for the given type.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr operator Entity() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr operator Entity() const noexcept {
|
||||
using entity_traits = entt_traits<Entity>;
|
||||
return entity_traits::combine(entity_traits::reserved, entity_traits::reserved);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ struct null_t {
|
||||
* @param other A null object.
|
||||
* @return True in all cases.
|
||||
*/
|
||||
[[nodiscard]] constexpr bool operator==([[maybe_unused]] const null_t other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==([[maybe_unused]] const null_t other) const noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ struct null_t {
|
||||
* @param other A null object.
|
||||
* @return False in all cases.
|
||||
*/
|
||||
[[nodiscard]] constexpr bool operator!=([[maybe_unused]] const null_t other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=([[maybe_unused]] const null_t other) const noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ struct null_t {
|
||||
* @return False if the two elements differ, true otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity) const noexcept {
|
||||
using entity_traits = entt_traits<Entity>;
|
||||
return entity_traits::to_entity(entity) == entity_traits::to_entity(*this);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ struct null_t {
|
||||
* @return True if the two elements differ, false otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity) const noexcept {
|
||||
return !(entity == *this);
|
||||
}
|
||||
};
|
||||
@@ -221,7 +221,7 @@ struct null_t {
|
||||
* @return False if the two elements differ, true otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity, const null_t other) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity, const null_t other) noexcept {
|
||||
return other.operator==(entity);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ template<typename Entity>
|
||||
* @return True if the two elements differ, false otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity, const null_t other) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity, const null_t other) noexcept {
|
||||
return !(other == entity);
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ struct tombstone_t {
|
||||
* @return The tombstone representation for the given type.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr operator Entity() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr operator Entity() const noexcept {
|
||||
using entity_traits = entt_traits<Entity>;
|
||||
return entity_traits::combine(entity_traits::reserved, entity_traits::reserved);
|
||||
}
|
||||
@@ -255,7 +255,7 @@ struct tombstone_t {
|
||||
* @param other A tombstone object.
|
||||
* @return True in all cases.
|
||||
*/
|
||||
[[nodiscard]] constexpr bool operator==([[maybe_unused]] const tombstone_t other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==([[maybe_unused]] const tombstone_t other) const noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ struct tombstone_t {
|
||||
* @param other A tombstone object.
|
||||
* @return False in all cases.
|
||||
*/
|
||||
[[nodiscard]] constexpr bool operator!=([[maybe_unused]] const tombstone_t other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=([[maybe_unused]] const tombstone_t other) const noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ struct tombstone_t {
|
||||
* @return False if the two elements differ, true otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity) const noexcept {
|
||||
using entity_traits = entt_traits<Entity>;
|
||||
return entity_traits::to_version(entity) == entity_traits::to_version(*this);
|
||||
}
|
||||
@@ -287,7 +287,7 @@ struct tombstone_t {
|
||||
* @return True if the two elements differ, false otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity) const noexcept {
|
||||
return !(entity == *this);
|
||||
}
|
||||
};
|
||||
@@ -300,7 +300,7 @@ struct tombstone_t {
|
||||
* @return False if the two elements differ, true otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity, const tombstone_t other) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const Entity entity, const tombstone_t other) noexcept {
|
||||
return other.operator==(entity);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ template<typename Entity>
|
||||
* @return True if the two elements differ, false otherwise.
|
||||
*/
|
||||
template<typename Entity>
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity, const tombstone_t other) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const Entity entity, const tombstone_t other) noexcept {
|
||||
return !(other == entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,25 +51,25 @@ public:
|
||||
: it{from},
|
||||
pools{cpools} {}
|
||||
|
||||
extended_group_iterator &operator++() ENTT_NOEXCEPT {
|
||||
extended_group_iterator &operator++() noexcept {
|
||||
return ++it, *this;
|
||||
}
|
||||
|
||||
extended_group_iterator operator++(int) ENTT_NOEXCEPT {
|
||||
extended_group_iterator operator++(int) noexcept {
|
||||
extended_group_iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
|
||||
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reference operator*() const noexcept {
|
||||
return std::tuple_cat(std::make_tuple(*it), index_to_element(*std::get<Owned *>(pools))..., std::get<Get *>(pools)->get_as_tuple(*it)...);
|
||||
}
|
||||
|
||||
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer operator->() const noexcept {
|
||||
return operator*();
|
||||
}
|
||||
|
||||
template<typename... Lhs, typename... Rhs>
|
||||
friend constexpr bool operator==(const extended_group_iterator<Lhs...> &, const extended_group_iterator<Rhs...> &) ENTT_NOEXCEPT;
|
||||
friend constexpr bool operator==(const extended_group_iterator<Lhs...> &, const extended_group_iterator<Rhs...> &) noexcept;
|
||||
|
||||
private:
|
||||
It it;
|
||||
@@ -77,12 +77,12 @@ private:
|
||||
};
|
||||
|
||||
template<typename... Lhs, typename... Rhs>
|
||||
[[nodiscard]] constexpr bool operator==(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) noexcept {
|
||||
return lhs.it == rhs.it;
|
||||
}
|
||||
|
||||
template<typename... Lhs, typename... Rhs>
|
||||
[[nodiscard]] constexpr bool operator!=(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ class basic_group<Entity, owned_t<>, get_t<Get...>, exclude_t<Exclude...>> {
|
||||
|
||||
using basic_common_type = std::common_type_t<typename storage_type<Get>::base_type...>;
|
||||
|
||||
basic_group(basic_common_type &ref, storage_type<Get> &...gpool) ENTT_NOEXCEPT
|
||||
basic_group(basic_common_type &ref, storage_type<Get> &...gpool) noexcept
|
||||
: handler{&ref},
|
||||
pools{&gpool...} {}
|
||||
|
||||
@@ -157,14 +157,14 @@ public:
|
||||
using iterable = iterable_adaptor<internal::extended_group_iterator<iterator, owned_t<>, get_t<storage_type<Get>...>>>;
|
||||
|
||||
/*! @brief Default constructor to use to create empty, invalid groups. */
|
||||
basic_group() ENTT_NOEXCEPT
|
||||
basic_group() noexcept
|
||||
: handler{} {}
|
||||
|
||||
/**
|
||||
* @brief Returns a const reference to the underlying handler.
|
||||
* @return A const reference to the underlying handler.
|
||||
*/
|
||||
const base_type &handle() const ENTT_NOEXCEPT {
|
||||
const base_type &handle() const noexcept {
|
||||
return *handler;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<typename Comp>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
return *std::get<index_of<Comp>>(pools);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<std::size_t Comp>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
return *std::get<Comp>(pools);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
* @brief Returns the number of entities that have the given components.
|
||||
* @return Number of entities that have the given components.
|
||||
*/
|
||||
[[nodiscard]] size_type size() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size() const noexcept {
|
||||
return *this ? handler->size() : size_type{};
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
* allocated space for.
|
||||
* @return Capacity of the group.
|
||||
*/
|
||||
[[nodiscard]] size_type capacity() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type capacity() const noexcept {
|
||||
return *this ? handler->capacity() : size_type{};
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public:
|
||||
* @brief Checks whether a group is empty.
|
||||
* @return True if the group is empty, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool empty() const noexcept {
|
||||
return !*this || handler->empty();
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the group.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator begin() const noexcept {
|
||||
return *this ? handler->begin() : iterator{};
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* group.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator end() const noexcept {
|
||||
return *this ? handler->end() : iterator{};
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the reversed group.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rbegin() const noexcept {
|
||||
return *this ? handler->rbegin() : reverse_iterator{};
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* reversed group.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rend() const noexcept {
|
||||
return *this ? handler->rend() : reverse_iterator{};
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
* @return The first entity of the group if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type front() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type front() const noexcept {
|
||||
const auto it = begin();
|
||||
return it != end() ? *it : null;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ public:
|
||||
* @return The last entity of the group if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type back() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type back() const noexcept {
|
||||
const auto it = rbegin();
|
||||
return it != rend() ? *it : null;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
[[nodiscard]] iterator find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator find(const entity_type entt) const noexcept {
|
||||
const auto it = *this ? handler->find(entt) : iterator{};
|
||||
return it != end() && *it == entt ? it : end();
|
||||
}
|
||||
@@ -317,7 +317,7 @@ public:
|
||||
* @brief Checks if a group is properly initialized.
|
||||
* @return True if the group is properly initialized, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] explicit operator bool() const noexcept {
|
||||
return handler != nullptr;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return True if the group contains the given entity, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool contains(const entity_type entt) const noexcept {
|
||||
return *this && handler->contains(entt);
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
*
|
||||
* @return An iterable object to use to _visit_ the group.
|
||||
*/
|
||||
[[nodiscard]] iterable each() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterable each() const noexcept {
|
||||
return iterable{{begin(), pools}, {end(), pools}};
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ class basic_group<Entity, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...
|
||||
template<typename Comp>
|
||||
using storage_type = constness_as_t<typename storage_traits<Entity, std::remove_const_t<Comp>>::storage_type, Comp>;
|
||||
|
||||
basic_group(const std::size_t &extent, storage_type<Owned> &...opool, storage_type<Get> &...gpool) ENTT_NOEXCEPT
|
||||
basic_group(const std::size_t &extent, storage_type<Owned> &...opool, storage_type<Get> &...gpool) noexcept
|
||||
: pools{&opool..., &gpool...},
|
||||
length{&extent} {}
|
||||
|
||||
@@ -555,7 +555,7 @@ public:
|
||||
using iterable = iterable_adaptor<internal::extended_group_iterator<iterator, owned_t<storage_type<Owned>...>, get_t<storage_type<Get>...>>>;
|
||||
|
||||
/*! @brief Default constructor to use to create empty, invalid groups. */
|
||||
basic_group() ENTT_NOEXCEPT
|
||||
basic_group() noexcept
|
||||
: length{} {}
|
||||
|
||||
/**
|
||||
@@ -564,7 +564,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<typename Comp>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
return *std::get<index_of<Comp>>(pools);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<std::size_t Comp>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
return *std::get<Comp>(pools);
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ public:
|
||||
* @brief Returns the number of entities that have the given components.
|
||||
* @return Number of entities that have the given components.
|
||||
*/
|
||||
[[nodiscard]] size_type size() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size() const noexcept {
|
||||
return *this ? *length : size_type{};
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ public:
|
||||
* @brief Checks whether a group is empty.
|
||||
* @return True if the group is empty, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool empty() const noexcept {
|
||||
return !*this || !*length;
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the group.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator begin() const noexcept {
|
||||
return *this ? (std::get<0>(pools)->base_type::end() - *length) : iterator{};
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* group.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator end() const noexcept {
|
||||
return *this ? std::get<0>(pools)->base_type::end() : iterator{};
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the reversed group.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rbegin() const noexcept {
|
||||
return *this ? std::get<0>(pools)->base_type::rbegin() : reverse_iterator{};
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* reversed group.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rend() const noexcept {
|
||||
return *this ? (std::get<0>(pools)->base_type::rbegin() + *length) : reverse_iterator{};
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ public:
|
||||
* @return The first entity of the group if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type front() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type front() const noexcept {
|
||||
const auto it = begin();
|
||||
return it != end() ? *it : null;
|
||||
}
|
||||
@@ -662,7 +662,7 @@ public:
|
||||
* @return The last entity of the group if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type back() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type back() const noexcept {
|
||||
const auto it = rbegin();
|
||||
return it != rend() ? *it : null;
|
||||
}
|
||||
@@ -673,7 +673,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
[[nodiscard]] iterator find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator find(const entity_type entt) const noexcept {
|
||||
const auto it = *this ? std::get<0>(pools)->find(entt) : iterator{};
|
||||
return it != end() && it >= begin() && *it == entt ? it : end();
|
||||
}
|
||||
@@ -691,7 +691,7 @@ public:
|
||||
* @brief Checks if a group is properly initialized.
|
||||
* @return True if the group is properly initialized, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] explicit operator bool() const noexcept {
|
||||
return length != nullptr;
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return True if the group contains the given entity, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool contains(const entity_type entt) const noexcept {
|
||||
return *this && std::get<0>(pools)->contains(entt) && (std::get<0>(pools)->index(entt) < (*length));
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ public:
|
||||
*
|
||||
* @return An iterable object to use to _visit_ the group.
|
||||
*/
|
||||
[[nodiscard]] iterable each() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterable each() const noexcept {
|
||||
return {{begin(), pools}, {end(), pools}};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include "../config/config.h"
|
||||
#include "../core/type_traits.hpp"
|
||||
#include "fwd.hpp"
|
||||
#include "registry.hpp"
|
||||
@@ -31,7 +30,7 @@ struct basic_handle {
|
||||
using size_type = typename registry_type::size_type;
|
||||
|
||||
/*! @brief Constructs an invalid handle. */
|
||||
basic_handle() ENTT_NOEXCEPT
|
||||
basic_handle() noexcept
|
||||
: reg{},
|
||||
entt{null} {}
|
||||
|
||||
@@ -40,7 +39,7 @@ struct basic_handle {
|
||||
* @param ref An instance of the registry class.
|
||||
* @param value A valid identifier.
|
||||
*/
|
||||
basic_handle(registry_type &ref, entity_type value) ENTT_NOEXCEPT
|
||||
basic_handle(registry_type &ref, entity_type value) noexcept
|
||||
: reg{&ref},
|
||||
entt{value} {}
|
||||
|
||||
@@ -52,7 +51,7 @@ struct basic_handle {
|
||||
* entity.
|
||||
*/
|
||||
template<typename Other, typename... Args>
|
||||
operator basic_handle<Other, Args...>() const ENTT_NOEXCEPT {
|
||||
operator basic_handle<Other, Args...>() const noexcept {
|
||||
static_assert(std::is_same_v<Other, Entity> || std::is_same_v<std::remove_const_t<Other>, Entity>, "Invalid conversion between different handles");
|
||||
static_assert((sizeof...(Type) == 0 || ((sizeof...(Args) != 0 && sizeof...(Args) <= sizeof...(Type)) && ... && (type_list_contains_v<type_list<Type...>, Args>))), "Invalid conversion between different handles");
|
||||
|
||||
@@ -63,7 +62,7 @@ struct basic_handle {
|
||||
* @brief Converts a handle to its underlying entity.
|
||||
* @return The contained identifier.
|
||||
*/
|
||||
[[nodiscard]] operator entity_type() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] operator entity_type() const noexcept {
|
||||
return entity();
|
||||
}
|
||||
|
||||
@@ -71,7 +70,7 @@ struct basic_handle {
|
||||
* @brief Checks if a handle refers to non-null registry pointer and entity.
|
||||
* @return True if the handle refers to non-null registry and entity, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] explicit operator bool() const noexcept {
|
||||
return reg && reg->valid(entt);
|
||||
}
|
||||
|
||||
@@ -87,7 +86,7 @@ struct basic_handle {
|
||||
* @brief Returns a pointer to the underlying registry, if any.
|
||||
* @return A pointer to the underlying registry, if any.
|
||||
*/
|
||||
[[nodiscard]] registry_type *registry() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] registry_type *registry() const noexcept {
|
||||
return reg;
|
||||
}
|
||||
|
||||
@@ -95,7 +94,7 @@ struct basic_handle {
|
||||
* @brief Returns the entity associated with a handle.
|
||||
* @return The entity associated with the handle.
|
||||
*/
|
||||
[[nodiscard]] entity_type entity() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type entity() const noexcept {
|
||||
return entt;
|
||||
}
|
||||
|
||||
@@ -303,7 +302,7 @@ private:
|
||||
* entity, false otherwise.
|
||||
*/
|
||||
template<typename... Args, typename... Other>
|
||||
[[nodiscard]] bool operator==(const basic_handle<Args...> &lhs, const basic_handle<Other...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool operator==(const basic_handle<Args...> &lhs, const basic_handle<Other...> &rhs) noexcept {
|
||||
return lhs.registry() == rhs.registry() && lhs.entity() == rhs.entity();
|
||||
}
|
||||
|
||||
@@ -317,7 +316,7 @@ template<typename... Args, typename... Other>
|
||||
* entity, true otherwise.
|
||||
*/
|
||||
template<typename... Args, typename... Other>
|
||||
[[nodiscard]] bool operator!=(const basic_handle<Args...> &lhs, const basic_handle<Other...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool operator!=(const basic_handle<Args...> &lhs, const basic_handle<Other...> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ struct as_view {
|
||||
* @brief Constructs a converter for a given registry.
|
||||
* @param source A valid reference to a registry.
|
||||
*/
|
||||
as_view(registry_type &source) ENTT_NOEXCEPT: reg{source} {}
|
||||
as_view(registry_type &source) noexcept
|
||||
: reg{source} {}
|
||||
|
||||
/**
|
||||
* @brief Conversion function from a registry to a view.
|
||||
@@ -72,7 +73,8 @@ struct as_group {
|
||||
* @brief Constructs a converter for a given registry.
|
||||
* @param source A valid reference to a registry.
|
||||
*/
|
||||
as_group(registry_type &source) ENTT_NOEXCEPT: reg{source} {}
|
||||
as_group(registry_type &source) noexcept
|
||||
: reg{source} {}
|
||||
|
||||
/**
|
||||
* @brief Conversion function from a registry to a group.
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include "../config/config.h"
|
||||
#include "../core/type_traits.hpp"
|
||||
#include "../signal/delegate.hpp"
|
||||
#include "entity.hpp"
|
||||
@@ -46,7 +45,7 @@ struct basic_collector<> {
|
||||
* @return The updated collector.
|
||||
*/
|
||||
template<typename... AllOf, typename... NoneOf>
|
||||
static constexpr auto group(exclude_t<NoneOf...> = {}) ENTT_NOEXCEPT {
|
||||
static constexpr auto group(exclude_t<NoneOf...> = {}) noexcept {
|
||||
return basic_collector<matcher<type_list<>, type_list<>, type_list<NoneOf...>, AllOf...>>{};
|
||||
}
|
||||
|
||||
@@ -56,7 +55,7 @@ struct basic_collector<> {
|
||||
* @return The updated collector.
|
||||
*/
|
||||
template<typename AnyOf>
|
||||
static constexpr auto update() ENTT_NOEXCEPT {
|
||||
static constexpr auto update() noexcept {
|
||||
return basic_collector<matcher<type_list<>, type_list<>, AnyOf>>{};
|
||||
}
|
||||
};
|
||||
@@ -81,7 +80,7 @@ struct basic_collector<matcher<type_list<Reject...>, type_list<Require...>, Rule
|
||||
* @return The updated collector.
|
||||
*/
|
||||
template<typename... AllOf, typename... NoneOf>
|
||||
static constexpr auto group(exclude_t<NoneOf...> = {}) ENTT_NOEXCEPT {
|
||||
static constexpr auto group(exclude_t<NoneOf...> = {}) noexcept {
|
||||
return basic_collector<matcher<type_list<>, type_list<>, type_list<NoneOf...>, AllOf...>, current_type, Other...>{};
|
||||
}
|
||||
|
||||
@@ -91,7 +90,7 @@ struct basic_collector<matcher<type_list<Reject...>, type_list<Require...>, Rule
|
||||
* @return The updated collector.
|
||||
*/
|
||||
template<typename AnyOf>
|
||||
static constexpr auto update() ENTT_NOEXCEPT {
|
||||
static constexpr auto update() noexcept {
|
||||
return basic_collector<matcher<type_list<>, type_list<>, AnyOf>, current_type, Other...>{};
|
||||
}
|
||||
|
||||
@@ -102,7 +101,7 @@ struct basic_collector<matcher<type_list<Reject...>, type_list<Require...>, Rule
|
||||
* @return The updated collector.
|
||||
*/
|
||||
template<typename... AllOf, typename... NoneOf>
|
||||
static constexpr auto where(exclude_t<NoneOf...> = {}) ENTT_NOEXCEPT {
|
||||
static constexpr auto where(exclude_t<NoneOf...> = {}) noexcept {
|
||||
using extended_type = matcher<type_list<Reject..., NoneOf...>, type_list<Require..., AllOf...>, Rule...>;
|
||||
return basic_collector<extended_type, Other...>{};
|
||||
}
|
||||
@@ -331,7 +330,7 @@ public:
|
||||
* @brief Returns the number of elements in an observer.
|
||||
* @return Number of elements.
|
||||
*/
|
||||
[[nodiscard]] size_type size() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size() const noexcept {
|
||||
return storage.size();
|
||||
}
|
||||
|
||||
@@ -339,7 +338,7 @@ public:
|
||||
* @brief Checks whether an observer is empty.
|
||||
* @return True if the observer is empty, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool empty() const noexcept {
|
||||
return storage.empty();
|
||||
}
|
||||
|
||||
@@ -355,7 +354,7 @@ public:
|
||||
*
|
||||
* @return A pointer to the array of entities.
|
||||
*/
|
||||
[[nodiscard]] const entity_type *data() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const entity_type *data() const noexcept {
|
||||
return storage.data();
|
||||
}
|
||||
|
||||
@@ -367,7 +366,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the observer.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator begin() const noexcept {
|
||||
return storage.basic_sparse_set<entity_type>::begin();
|
||||
}
|
||||
|
||||
@@ -381,12 +380,12 @@ public:
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* observer.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator end() const noexcept {
|
||||
return storage.basic_sparse_set<entity_type>::end();
|
||||
}
|
||||
|
||||
/*! @brief Clears the underlying container. */
|
||||
void clear() ENTT_NOEXCEPT {
|
||||
void clear() noexcept {
|
||||
storage.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
* @param length The length of the user-supplied buffer.
|
||||
* @return The number of type info objects written to the buffer.
|
||||
*/
|
||||
size_type ro_dependency(const type_info **buffer, const std::size_t length) const ENTT_NOEXCEPT {
|
||||
size_type ro_dependency(const type_info **buffer, const std::size_t length) const noexcept {
|
||||
return node.dependency(false, buffer, length);
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
* @param length The length of the user-supplied buffer.
|
||||
* @return The number of type info objects written to the buffer.
|
||||
*/
|
||||
size_type rw_dependency(const type_info **buffer, const std::size_t length) const ENTT_NOEXCEPT {
|
||||
size_type rw_dependency(const type_info **buffer, const std::size_t length) const noexcept {
|
||||
return node.dependency(true, buffer, length);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
* @brief Returns the number of read-only resources of a vertex.
|
||||
* @return The number of read-only resources of the vertex.
|
||||
*/
|
||||
size_type ro_count() const ENTT_NOEXCEPT {
|
||||
size_type ro_count() const noexcept {
|
||||
return node.ro_count;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
* @brief Returns the number of writable resources of a vertex.
|
||||
* @return The number of writable resources of the vertex.
|
||||
*/
|
||||
size_type rw_count() const ENTT_NOEXCEPT {
|
||||
size_type rw_count() const noexcept {
|
||||
return node.rw_count;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ public:
|
||||
* @brief Checks if a vertex is also a top-level one.
|
||||
* @return True if the vertex is a top-level one, false otherwise.
|
||||
*/
|
||||
bool top_level() const ENTT_NOEXCEPT {
|
||||
bool top_level() const noexcept {
|
||||
return is_top_level;
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
* @brief Returns a type info object associated with a vertex.
|
||||
* @return A properly initialized type info object.
|
||||
*/
|
||||
const type_info &info() const ENTT_NOEXCEPT {
|
||||
const type_info &info() const noexcept {
|
||||
return *node.info;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
* @brief Returns a user defined name associated with a vertex, if any.
|
||||
* @return The user defined name associated with the vertex, if any.
|
||||
*/
|
||||
const char *name() const ENTT_NOEXCEPT {
|
||||
const char *name() const noexcept {
|
||||
return node.name;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
* @brief Returns the function associated with a vertex.
|
||||
* @return The function associated with the vertex.
|
||||
*/
|
||||
function_type *callback() const ENTT_NOEXCEPT {
|
||||
function_type *callback() const noexcept {
|
||||
return node.callback;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public:
|
||||
* @brief Returns the payload associated with a vertex, if any.
|
||||
* @return The payload associated with the vertex, if any.
|
||||
*/
|
||||
const void *data() const ENTT_NOEXCEPT {
|
||||
const void *data() const noexcept {
|
||||
return node.payload;
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
* @brief Returns the list of nodes reachable from a given vertex.
|
||||
* @return The list of nodes reachable from the vertex.
|
||||
*/
|
||||
const std::vector<std::size_t> &children() const ENTT_NOEXCEPT {
|
||||
const std::vector<std::size_t> &children() const noexcept {
|
||||
return reachable;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,109 +50,109 @@ public:
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using iterator_category = std::input_iterator_tag;
|
||||
|
||||
constexpr storage_proxy_iterator() ENTT_NOEXCEPT
|
||||
constexpr storage_proxy_iterator() noexcept
|
||||
: it{} {}
|
||||
|
||||
constexpr storage_proxy_iterator(const It iter) ENTT_NOEXCEPT
|
||||
constexpr storage_proxy_iterator(const It iter) noexcept
|
||||
: it{iter} {}
|
||||
|
||||
template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
|
||||
constexpr storage_proxy_iterator(const storage_proxy_iterator<Other> &other) ENTT_NOEXCEPT
|
||||
constexpr storage_proxy_iterator(const storage_proxy_iterator<Other> &other) noexcept
|
||||
: it{other.it} {}
|
||||
|
||||
constexpr storage_proxy_iterator &operator++() ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator &operator++() noexcept {
|
||||
return ++it, *this;
|
||||
}
|
||||
|
||||
constexpr storage_proxy_iterator operator++(int) ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator operator++(int) noexcept {
|
||||
storage_proxy_iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
|
||||
constexpr storage_proxy_iterator &operator--() ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator &operator--() noexcept {
|
||||
return --it, *this;
|
||||
}
|
||||
|
||||
constexpr storage_proxy_iterator operator--(int) ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator operator--(int) noexcept {
|
||||
storage_proxy_iterator orig = *this;
|
||||
return operator--(), orig;
|
||||
}
|
||||
|
||||
constexpr storage_proxy_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator &operator+=(const difference_type value) noexcept {
|
||||
it += value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr storage_proxy_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator operator+(const difference_type value) const noexcept {
|
||||
storage_proxy_iterator copy = *this;
|
||||
return (copy += value);
|
||||
}
|
||||
|
||||
constexpr storage_proxy_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator &operator-=(const difference_type value) noexcept {
|
||||
return (*this += -value);
|
||||
}
|
||||
|
||||
constexpr storage_proxy_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
|
||||
constexpr storage_proxy_iterator operator-(const difference_type value) const noexcept {
|
||||
return (*this + -value);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr reference operator[](const difference_type value) const noexcept {
|
||||
return {it[value].first, *it[value].second};
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr reference operator*() const noexcept {
|
||||
return {it->first, *it->second};
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr pointer operator->() const noexcept {
|
||||
return operator*();
|
||||
}
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
friend constexpr std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
|
||||
friend constexpr std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) noexcept;
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
friend constexpr bool operator==(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
|
||||
friend constexpr bool operator==(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) noexcept;
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
friend constexpr bool operator<(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
|
||||
friend constexpr bool operator<(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) noexcept;
|
||||
|
||||
private:
|
||||
It it;
|
||||
};
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
[[nodiscard]] constexpr std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) noexcept {
|
||||
return lhs.it - rhs.it;
|
||||
}
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
[[nodiscard]] constexpr bool operator==(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) noexcept {
|
||||
return lhs.it == rhs.it;
|
||||
}
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
[[nodiscard]] constexpr bool operator!=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
[[nodiscard]] constexpr bool operator<(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator<(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) noexcept {
|
||||
return lhs.it < rhs.it;
|
||||
}
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
[[nodiscard]] constexpr bool operator>(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator>(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) noexcept {
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
[[nodiscard]] constexpr bool operator<=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator<=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) noexcept {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
template<typename ILhs, typename IRhs>
|
||||
[[nodiscard]] constexpr bool operator>=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator>=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) noexcept {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
@@ -268,9 +268,9 @@ class basic_registry {
|
||||
struct group_data {
|
||||
std::size_t size;
|
||||
std::unique_ptr<void, void (*)(void *)> group;
|
||||
bool (*owned)(const id_type) ENTT_NOEXCEPT;
|
||||
bool (*get)(const id_type) ENTT_NOEXCEPT;
|
||||
bool (*exclude)(const id_type) ENTT_NOEXCEPT;
|
||||
bool (*owned)(const id_type) noexcept;
|
||||
bool (*get)(const id_type) noexcept;
|
||||
bool (*exclude)(const id_type) noexcept;
|
||||
};
|
||||
|
||||
template<typename Component>
|
||||
@@ -300,12 +300,12 @@ class basic_registry {
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
auto generate_identifier(const std::size_t pos) ENTT_NOEXCEPT {
|
||||
auto generate_identifier(const std::size_t pos) noexcept {
|
||||
ENTT_ASSERT(pos < entity_traits::to_entity(null), "No entities available");
|
||||
return entity_traits::combine(static_cast<typename entity_traits::entity_type>(pos), {});
|
||||
}
|
||||
|
||||
auto recycle_identifier() ENTT_NOEXCEPT {
|
||||
auto recycle_identifier() noexcept {
|
||||
ENTT_ASSERT(free_list != null, "No entities available");
|
||||
const auto curr = entity_traits::to_entity(free_list);
|
||||
free_list = entity_traits::combine(entity_traits::to_integral(epool[curr]), tombstone);
|
||||
@@ -390,12 +390,12 @@ public:
|
||||
*
|
||||
* @return An iterable object to use to _visit_ the registry.
|
||||
*/
|
||||
[[nodiscard]] auto storage() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto storage() noexcept {
|
||||
return iterable_adaptor{internal::storage_proxy_iterator{pools.begin()}, internal::storage_proxy_iterator{pools.end()}};
|
||||
}
|
||||
|
||||
/*! @copydoc storage */
|
||||
[[nodiscard]] auto storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto storage() const noexcept {
|
||||
return iterable_adaptor{internal::storage_proxy_iterator{pools.cbegin()}, internal::storage_proxy_iterator{pools.cend()}};
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ public:
|
||||
* @brief Returns the number of entities created so far.
|
||||
* @return Number of entities created so far.
|
||||
*/
|
||||
[[nodiscard]] size_type size() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size() const noexcept {
|
||||
return epool.size();
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ public:
|
||||
* allocated space for.
|
||||
* @return Capacity of the registry.
|
||||
*/
|
||||
[[nodiscard]] size_type capacity() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type capacity() const noexcept {
|
||||
return epool.capacity();
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ public:
|
||||
*
|
||||
* @return A pointer to the array of entities.
|
||||
*/
|
||||
[[nodiscard]] const entity_type *data() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const entity_type *data() const noexcept {
|
||||
return epool.data();
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ public:
|
||||
*
|
||||
* @return The head of the list of released entities.
|
||||
*/
|
||||
[[nodiscard]] entity_type released() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type released() const noexcept {
|
||||
return free_list;
|
||||
}
|
||||
|
||||
@@ -1284,9 +1284,9 @@ public:
|
||||
group_data candidate = {
|
||||
size,
|
||||
{new handler_type{}, [](void *instance) { delete static_cast<handler_type *>(instance); }},
|
||||
[]([[maybe_unused]] const id_type ctype) ENTT_NOEXCEPT { return ((ctype == type_hash<std::remove_const_t<Owned>>::value()) || ...); },
|
||||
[]([[maybe_unused]] const id_type ctype) ENTT_NOEXCEPT { return ((ctype == type_hash<std::remove_const_t<Get>>::value()) || ...); },
|
||||
[]([[maybe_unused]] const id_type ctype) ENTT_NOEXCEPT { return ((ctype == type_hash<std::remove_const_t<Exclude>>::value()) || ...); },
|
||||
[]([[maybe_unused]] const id_type ctype) noexcept { return ((ctype == type_hash<std::remove_const_t<Owned>>::value()) || ...); },
|
||||
[]([[maybe_unused]] const id_type ctype) noexcept { return ((ctype == type_hash<std::remove_const_t<Get>>::value()) || ...); },
|
||||
[]([[maybe_unused]] const id_type ctype) noexcept { return ((ctype == type_hash<std::remove_const_t<Exclude>>::value()) || ...); },
|
||||
};
|
||||
|
||||
handler = static_cast<handler_type *>(candidate.group.get());
|
||||
@@ -1378,7 +1378,7 @@ public:
|
||||
* @return True if the group can be sorted, false otherwise.
|
||||
*/
|
||||
template<typename... Owned, typename... Get, typename... Exclude>
|
||||
[[nodiscard]] bool sortable(const basic_group<entity_type, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> &) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool sortable(const basic_group<entity_type, owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> &) noexcept {
|
||||
constexpr auto size = sizeof...(Owned) + sizeof...(Get) + sizeof...(Exclude);
|
||||
auto pred = [size](const auto &gdata) { return (0u + ... + gdata.owned(type_hash<std::remove_const_t<Owned>>::value())) && (size < gdata.size); };
|
||||
return std::find_if(groups.cbegin(), groups.cend(), std::move(pred)) == groups.cend();
|
||||
@@ -1461,12 +1461,12 @@ public:
|
||||
* @brief Returns the context object, that is, a general purpose container.
|
||||
* @return The context object, that is, a general purpose container.
|
||||
*/
|
||||
context &ctx() ENTT_NOEXCEPT {
|
||||
context &ctx() noexcept {
|
||||
return vars;
|
||||
}
|
||||
|
||||
/*! @copydoc ctx */
|
||||
const context &ctx() const ENTT_NOEXCEPT {
|
||||
const context &ctx() const noexcept {
|
||||
return vars;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "../config/config.h"
|
||||
#include "entity.hpp"
|
||||
#include "fwd.hpp"
|
||||
#include "sparse_set.hpp"
|
||||
@@ -37,13 +36,13 @@ public:
|
||||
using reference = typename iterator_type::reference;
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
|
||||
constexpr runtime_view_iterator() ENTT_NOEXCEPT
|
||||
constexpr runtime_view_iterator() noexcept
|
||||
: pools{},
|
||||
filter{},
|
||||
it{},
|
||||
tombstone_check{} {}
|
||||
|
||||
runtime_view_iterator(const std::vector<const Set *> &cpools, const std::vector<const Set *> &ignore, iterator_type curr) ENTT_NOEXCEPT
|
||||
runtime_view_iterator(const std::vector<const Set *> &cpools, const std::vector<const Set *> &ignore, iterator_type curr) noexcept
|
||||
: pools{&cpools},
|
||||
filter{&ignore},
|
||||
it{curr},
|
||||
@@ -73,19 +72,19 @@ public:
|
||||
return operator--(), orig;
|
||||
}
|
||||
|
||||
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer operator->() const noexcept {
|
||||
return it.operator->();
|
||||
}
|
||||
|
||||
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reference operator*() const noexcept {
|
||||
return *operator->();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool operator==(const runtime_view_iterator &other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const runtime_view_iterator &other) const noexcept {
|
||||
return it == other.it;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool operator!=(const runtime_view_iterator &other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const runtime_view_iterator &other) const noexcept {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
@@ -163,7 +162,7 @@ struct basic_runtime_view<basic_sparse_set<Entity, Allocator>> {
|
||||
using iterator = internal::runtime_view_iterator<base_type>;
|
||||
|
||||
/*! @brief Default constructor to use to create empty, invalid views. */
|
||||
basic_runtime_view() ENTT_NOEXCEPT
|
||||
basic_runtime_view() noexcept
|
||||
: pools{},
|
||||
filter{} {}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
* @brief Move constructor.
|
||||
* @param other The instance to move from.
|
||||
*/
|
||||
sigh_storage_mixin(sigh_storage_mixin &&other) ENTT_NOEXCEPT
|
||||
sigh_storage_mixin(sigh_storage_mixin &&other) noexcept
|
||||
: Type{std::move(other)},
|
||||
owner{other.owner},
|
||||
construction{std::move(other.construction)},
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
* @param other The instance to move from.
|
||||
* @param allocator The allocator to use.
|
||||
*/
|
||||
sigh_storage_mixin(sigh_storage_mixin &&other, const allocator_type &allocator) ENTT_NOEXCEPT
|
||||
sigh_storage_mixin(sigh_storage_mixin &&other, const allocator_type &allocator) noexcept
|
||||
: Type{std::move(other), allocator},
|
||||
owner{other.owner},
|
||||
construction{std::move(other.construction), allocator},
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
* @param other The instance to move from.
|
||||
* @return This storage.
|
||||
*/
|
||||
sigh_storage_mixin &operator=(sigh_storage_mixin &&other) ENTT_NOEXCEPT {
|
||||
sigh_storage_mixin &operator=(sigh_storage_mixin &&other) noexcept {
|
||||
Type::operator=(std::move(other));
|
||||
owner = other.owner;
|
||||
construction = std::move(other.construction);
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
*
|
||||
* @return A temporary sink object.
|
||||
*/
|
||||
[[nodiscard]] auto on_construct() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto on_construct() noexcept {
|
||||
return sink{construction};
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
*
|
||||
* @return A temporary sink object.
|
||||
*/
|
||||
[[nodiscard]] auto on_update() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto on_update() noexcept {
|
||||
return sink{update};
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
*
|
||||
* @return A temporary sink object.
|
||||
*/
|
||||
[[nodiscard]] auto on_destroy() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto on_destroy() noexcept {
|
||||
return sink{destruction};
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
* @brief Forwards variables to mixins, if any.
|
||||
* @param value A variable wrapped in an opaque container.
|
||||
*/
|
||||
void bind(any value) ENTT_NOEXCEPT final {
|
||||
void bind(any value) noexcept final {
|
||||
auto *reg = any_cast<basic_registry<entity_type>>(&value);
|
||||
owner = reg ? reg : owner;
|
||||
Type::bind(std::move(value));
|
||||
|
||||
@@ -67,14 +67,14 @@ public:
|
||||
* @brief Constructs an instance that is bound to a given registry.
|
||||
* @param source A valid reference to a registry.
|
||||
*/
|
||||
basic_snapshot(const basic_registry<entity_type> &source) ENTT_NOEXCEPT
|
||||
basic_snapshot(const basic_registry<entity_type> &source) noexcept
|
||||
: reg{&source} {}
|
||||
|
||||
/*! @brief Default move constructor. */
|
||||
basic_snapshot(basic_snapshot &&) ENTT_NOEXCEPT = default;
|
||||
basic_snapshot(basic_snapshot &&) noexcept = default;
|
||||
|
||||
/*! @brief Default move assignment operator. @return This snapshot. */
|
||||
basic_snapshot &operator=(basic_snapshot &&) ENTT_NOEXCEPT = default;
|
||||
basic_snapshot &operator=(basic_snapshot &&) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Puts aside all the entities from the underlying registry.
|
||||
@@ -195,17 +195,17 @@ public:
|
||||
* @brief Constructs an instance that is bound to a given registry.
|
||||
* @param source A valid reference to a registry.
|
||||
*/
|
||||
basic_snapshot_loader(basic_registry<entity_type> &source) ENTT_NOEXCEPT
|
||||
basic_snapshot_loader(basic_registry<entity_type> &source) noexcept
|
||||
: reg{&source} {
|
||||
// restoring a snapshot as a whole requires a clean registry
|
||||
ENTT_ASSERT(reg->empty(), "Registry must be empty");
|
||||
}
|
||||
|
||||
/*! @brief Default move constructor. */
|
||||
basic_snapshot_loader(basic_snapshot_loader &&) ENTT_NOEXCEPT = default;
|
||||
basic_snapshot_loader(basic_snapshot_loader &&) noexcept = default;
|
||||
|
||||
/*! @brief Default move assignment operator. @return This loader. */
|
||||
basic_snapshot_loader &operator=(basic_snapshot_loader &&) ENTT_NOEXCEPT = default;
|
||||
basic_snapshot_loader &operator=(basic_snapshot_loader &&) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Restores entities that were in use during serialization.
|
||||
@@ -409,7 +409,7 @@ public:
|
||||
* @brief Constructs an instance that is bound to a given registry.
|
||||
* @param source A valid reference to a registry.
|
||||
*/
|
||||
basic_continuous_loader(basic_registry<entity_type> &source) ENTT_NOEXCEPT
|
||||
basic_continuous_loader(basic_registry<entity_type> &source) noexcept
|
||||
: reg{&source} {}
|
||||
|
||||
/*! @brief Default move constructor. */
|
||||
@@ -531,7 +531,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return True if `entity` is managed by the loader, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool contains(entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool contains(entity_type entt) const noexcept {
|
||||
return (remloc.find(entt) != remloc.cend());
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return The local identifier if any, the null entity otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type map(entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type map(entity_type entt) const noexcept {
|
||||
const auto it = remloc.find(entt);
|
||||
entity_type other = null;
|
||||
|
||||
|
||||
@@ -32,63 +32,63 @@ struct sparse_set_iterator final {
|
||||
using difference_type = typename Container::difference_type;
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
|
||||
constexpr sparse_set_iterator() ENTT_NOEXCEPT
|
||||
constexpr sparse_set_iterator() noexcept
|
||||
: packed{},
|
||||
offset{} {}
|
||||
|
||||
constexpr sparse_set_iterator(const Container &ref, const difference_type idx) ENTT_NOEXCEPT
|
||||
constexpr sparse_set_iterator(const Container &ref, const difference_type idx) noexcept
|
||||
: packed{std::addressof(ref)},
|
||||
offset{idx} {}
|
||||
|
||||
constexpr sparse_set_iterator &operator++() ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator &operator++() noexcept {
|
||||
return --offset, *this;
|
||||
}
|
||||
|
||||
constexpr sparse_set_iterator operator++(int) ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator operator++(int) noexcept {
|
||||
sparse_set_iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
|
||||
constexpr sparse_set_iterator &operator--() ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator &operator--() noexcept {
|
||||
return ++offset, *this;
|
||||
}
|
||||
|
||||
constexpr sparse_set_iterator operator--(int) ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator operator--(int) noexcept {
|
||||
sparse_set_iterator orig = *this;
|
||||
return operator--(), orig;
|
||||
}
|
||||
|
||||
constexpr sparse_set_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator &operator+=(const difference_type value) noexcept {
|
||||
offset -= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr sparse_set_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator operator+(const difference_type value) const noexcept {
|
||||
sparse_set_iterator copy = *this;
|
||||
return (copy += value);
|
||||
}
|
||||
|
||||
constexpr sparse_set_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator &operator-=(const difference_type value) noexcept {
|
||||
return (*this += -value);
|
||||
}
|
||||
|
||||
constexpr sparse_set_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
|
||||
constexpr sparse_set_iterator operator-(const difference_type value) const noexcept {
|
||||
return (*this + -value);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr reference operator[](const difference_type value) const noexcept {
|
||||
return packed->data()[index() - value];
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr pointer operator->() const noexcept {
|
||||
return packed->data() + index();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr reference operator*() const noexcept {
|
||||
return *operator->();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr difference_type index() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr difference_type index() const noexcept {
|
||||
return offset - 1;
|
||||
}
|
||||
|
||||
@@ -98,37 +98,37 @@ private:
|
||||
};
|
||||
|
||||
template<typename Type, typename Other>
|
||||
[[nodiscard]] constexpr std::ptrdiff_t operator-(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr std::ptrdiff_t operator-(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) noexcept {
|
||||
return rhs.index() - lhs.index();
|
||||
}
|
||||
|
||||
template<typename Type, typename Other>
|
||||
[[nodiscard]] constexpr bool operator==(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) noexcept {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
|
||||
template<typename Type, typename Other>
|
||||
[[nodiscard]] constexpr bool operator!=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template<typename Type, typename Other>
|
||||
[[nodiscard]] constexpr bool operator<(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator<(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) noexcept {
|
||||
return lhs.index() > rhs.index();
|
||||
}
|
||||
|
||||
template<typename Type, typename Other>
|
||||
[[nodiscard]] constexpr bool operator>(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator>(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) noexcept {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
|
||||
template<typename Type, typename Other>
|
||||
[[nodiscard]] constexpr bool operator<=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator<=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) noexcept {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
template<typename Type, typename Other>
|
||||
[[nodiscard]] constexpr bool operator>=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator>=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) noexcept {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public:
|
||||
* @brief Move constructor.
|
||||
* @param other The instance to move from.
|
||||
*/
|
||||
basic_sparse_set(basic_sparse_set &&other) ENTT_NOEXCEPT
|
||||
basic_sparse_set(basic_sparse_set &&other) noexcept
|
||||
: sparse{std::move(other.sparse)},
|
||||
packed{std::move(other.packed)},
|
||||
info{other.info},
|
||||
@@ -352,7 +352,7 @@ public:
|
||||
* @param other The instance to move from.
|
||||
* @param allocator The allocator to use.
|
||||
*/
|
||||
basic_sparse_set(basic_sparse_set &&other, const allocator_type &allocator) ENTT_NOEXCEPT
|
||||
basic_sparse_set(basic_sparse_set &&other, const allocator_type &allocator) v
|
||||
: sparse{std::move(other.sparse), allocator},
|
||||
packed{std::move(other.packed), allocator},
|
||||
info{other.info},
|
||||
@@ -371,7 +371,7 @@ public:
|
||||
* @param other The instance to move from.
|
||||
* @return This sparse set.
|
||||
*/
|
||||
basic_sparse_set &operator=(basic_sparse_set &&other) ENTT_NOEXCEPT {
|
||||
basic_sparse_set &operator=(basic_sparse_set &&other) noexcept {
|
||||
ENTT_ASSERT(alloc_traits::is_always_equal::value || packed.get_allocator() == other.packed.get_allocator(), "Copying a sparse set is not allowed");
|
||||
|
||||
release_sparse_pages();
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
* @brief Returns the associated allocator.
|
||||
* @return The associated allocator.
|
||||
*/
|
||||
[[nodiscard]] constexpr allocator_type get_allocator() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr allocator_type get_allocator() const noexcept {
|
||||
return packed.get_allocator();
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ public:
|
||||
* @brief Returns the deletion policy of a sparse set.
|
||||
* @return The deletion policy of the sparse set.
|
||||
*/
|
||||
[[nodiscard]] deletion_policy policy() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] deletion_policy policy() const noexcept {
|
||||
return mode;
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ public:
|
||||
* allocated space for.
|
||||
* @return Capacity of the sparse set.
|
||||
*/
|
||||
[[nodiscard]] virtual size_type capacity() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] virtual size_type capacity() const noexcept {
|
||||
return packed.capacity();
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ public:
|
||||
*
|
||||
* @return Extent of the sparse set.
|
||||
*/
|
||||
[[nodiscard]] size_type extent() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type extent() const noexcept {
|
||||
return sparse.size() * entity_traits::page_size;
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ public:
|
||||
*
|
||||
* @return Number of elements.
|
||||
*/
|
||||
[[nodiscard]] size_type size() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size() const noexcept {
|
||||
return packed.size();
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ public:
|
||||
* @brief Checks whether a sparse set is empty.
|
||||
* @return True if the sparse set is empty, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool empty() const noexcept {
|
||||
return packed.empty();
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ public:
|
||||
* @brief Direct access to the internal packed array.
|
||||
* @return A pointer to the internal packed array.
|
||||
*/
|
||||
[[nodiscard]] pointer data() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer data() const noexcept {
|
||||
return packed.data();
|
||||
}
|
||||
|
||||
@@ -491,13 +491,13 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the sparse set.
|
||||
*/
|
||||
[[nodiscard]] const_iterator begin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterator begin() const noexcept {
|
||||
const auto pos = static_cast<typename iterator::difference_type>(packed.size());
|
||||
return iterator{packed, pos};
|
||||
}
|
||||
|
||||
/*! @copydoc begin */
|
||||
[[nodiscard]] const_iterator cbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterator cbegin() const noexcept {
|
||||
return begin();
|
||||
}
|
||||
|
||||
@@ -511,12 +511,12 @@ public:
|
||||
* @return An iterator to the element following the last entity of a sparse
|
||||
* set.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator end() const noexcept {
|
||||
return iterator{packed, {}};
|
||||
}
|
||||
|
||||
/*! @copydoc end */
|
||||
[[nodiscard]] const_iterator cend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterator cend() const noexcept {
|
||||
return end();
|
||||
}
|
||||
|
||||
@@ -530,12 +530,12 @@ public:
|
||||
* @return An iterator to the first entity of the reversed internal packed
|
||||
* array.
|
||||
*/
|
||||
[[nodiscard]] const_reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_reverse_iterator rbegin() const noexcept {
|
||||
return std::make_reverse_iterator(end());
|
||||
}
|
||||
|
||||
/*! @copydoc rbegin */
|
||||
[[nodiscard]] const_reverse_iterator crbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_reverse_iterator crbegin() const noexcept {
|
||||
return rbegin();
|
||||
}
|
||||
|
||||
@@ -549,12 +549,12 @@ public:
|
||||
* @return An iterator to the element following the last entity of the
|
||||
* reversed sparse set.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rend() const noexcept {
|
||||
return std::make_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
/*! @copydoc rend */
|
||||
[[nodiscard]] const_reverse_iterator crend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_reverse_iterator crend() const noexcept {
|
||||
return rend();
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
[[nodiscard]] iterator find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator find(const entity_type entt) const noexcept {
|
||||
return contains(entt) ? --(end() - index(entt)) : end();
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return True if the sparse set contains the entity, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool contains(const entity_type entt) const noexcept {
|
||||
const auto elem = sparse_ptr(entt);
|
||||
constexpr auto cap = entity_traits::to_entity(null);
|
||||
// testing versions permits to avoid accessing the packed array
|
||||
@@ -586,7 +586,7 @@ public:
|
||||
* @return The version for the given identifier if present, the tombstone
|
||||
* version otherwise.
|
||||
*/
|
||||
[[nodiscard]] version_type current(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] version_type current(const entity_type entt) const noexcept {
|
||||
const auto elem = sparse_ptr(entt);
|
||||
constexpr auto fallback = entity_traits::to_version(tombstone);
|
||||
return elem ? entity_traits::to_version(*elem) : fallback;
|
||||
@@ -602,7 +602,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return The position of the entity in the sparse set.
|
||||
*/
|
||||
[[nodiscard]] size_type index(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type index(const entity_type entt) const noexcept {
|
||||
ENTT_ASSERT(contains(entt), "Set does not contain entity");
|
||||
return static_cast<size_type>(entity_traits::to_entity(sparse_ref(entt)));
|
||||
}
|
||||
@@ -612,7 +612,7 @@ public:
|
||||
* @param pos The position for which to return the entity.
|
||||
* @return The entity at specified location if any, a null entity otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type at(const size_type pos) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type at(const size_type pos) const noexcept {
|
||||
return pos < packed.size() ? packed[pos] : null;
|
||||
}
|
||||
|
||||
@@ -621,7 +621,7 @@ public:
|
||||
* @param pos The position for which to return the entity.
|
||||
* @return The entity at specified location.
|
||||
*/
|
||||
[[nodiscard]] entity_type operator[](const size_type pos) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type operator[](const size_type pos) const noexcept {
|
||||
ENTT_ASSERT(pos < packed.size(), "Position is out of bounds");
|
||||
return packed[pos];
|
||||
}
|
||||
@@ -636,12 +636,12 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return An opaque pointer to the element assigned to the entity, if any.
|
||||
*/
|
||||
[[nodiscard]] const void *get(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const void *get(const entity_type entt) const noexcept {
|
||||
return get_at(index(entt));
|
||||
}
|
||||
|
||||
/*! @copydoc get */
|
||||
[[nodiscard]] void *get(const entity_type entt) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] void *get(const entity_type entt) noexcept {
|
||||
return const_cast<void *>(std::as_const(*this).get(entt));
|
||||
}
|
||||
|
||||
@@ -939,12 +939,12 @@ public:
|
||||
* @brief Returned value type, if any.
|
||||
* @return Returned value type, if any.
|
||||
*/
|
||||
const type_info &type() const ENTT_NOEXCEPT {
|
||||
const type_info &type() const noexcept {
|
||||
return *info;
|
||||
}
|
||||
|
||||
/*! @brief Forwards variables to mixins, if any. */
|
||||
virtual void bind(any) ENTT_NOEXCEPT {}
|
||||
virtual void bind(any) noexcept {}
|
||||
|
||||
private:
|
||||
sparse_container_type sparse;
|
||||
|
||||
@@ -48,68 +48,68 @@ public:
|
||||
using difference_type = typename iterator_traits::difference_type;
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
|
||||
constexpr storage_iterator() ENTT_NOEXCEPT = default;
|
||||
constexpr storage_iterator() noexcept = default;
|
||||
|
||||
constexpr storage_iterator(Container *ref, difference_type idx) ENTT_NOEXCEPT
|
||||
constexpr storage_iterator(Container *ref, difference_type idx) noexcept
|
||||
: packed{ref},
|
||||
offset{idx} {}
|
||||
|
||||
template<bool Const = std::is_const_v<Container>, typename = std::enable_if_t<Const>>
|
||||
constexpr storage_iterator(const storage_iterator<std::remove_const_t<Container>> &other) ENTT_NOEXCEPT
|
||||
constexpr storage_iterator(const storage_iterator<std::remove_const_t<Container>> &other) noexcept
|
||||
: packed{other.packed},
|
||||
offset{other.offset} {}
|
||||
|
||||
constexpr storage_iterator &operator++() ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator &operator++() noexcept {
|
||||
return --offset, *this;
|
||||
}
|
||||
|
||||
constexpr storage_iterator operator++(int) ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator operator++(int) noexcept {
|
||||
storage_iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
|
||||
constexpr storage_iterator &operator--() ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator &operator--() noexcept {
|
||||
return ++offset, *this;
|
||||
}
|
||||
|
||||
constexpr storage_iterator operator--(int) ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator operator--(int) noexcept {
|
||||
storage_iterator orig = *this;
|
||||
return operator--(), orig;
|
||||
}
|
||||
|
||||
constexpr storage_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator &operator+=(const difference_type value) noexcept {
|
||||
offset -= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr storage_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator operator+(const difference_type value) const noexcept {
|
||||
storage_iterator copy = *this;
|
||||
return (copy += value);
|
||||
}
|
||||
|
||||
constexpr storage_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator &operator-=(const difference_type value) noexcept {
|
||||
return (*this += -value);
|
||||
}
|
||||
|
||||
constexpr storage_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
|
||||
constexpr storage_iterator operator-(const difference_type value) const noexcept {
|
||||
return (*this + -value);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr reference operator[](const difference_type value) const noexcept {
|
||||
const auto pos = index() - value;
|
||||
return (*packed)[pos / comp_traits::page_size][fast_mod(pos, comp_traits::page_size)];
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr pointer operator->() const noexcept {
|
||||
const auto pos = index();
|
||||
return (*packed)[pos / comp_traits::page_size] + fast_mod(pos, comp_traits::page_size);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr reference operator*() const noexcept {
|
||||
return *operator->();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr difference_type index() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr difference_type index() const noexcept {
|
||||
return offset - 1;
|
||||
}
|
||||
|
||||
@@ -119,37 +119,37 @@ private:
|
||||
};
|
||||
|
||||
template<typename CLhs, typename CRhs>
|
||||
[[nodiscard]] constexpr std::ptrdiff_t operator-(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr std::ptrdiff_t operator-(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) noexcept {
|
||||
return rhs.index() - lhs.index();
|
||||
}
|
||||
|
||||
template<typename CLhs, typename CRhs>
|
||||
[[nodiscard]] constexpr bool operator==(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) noexcept {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
|
||||
template<typename CLhs, typename CRhs>
|
||||
[[nodiscard]] constexpr bool operator!=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template<typename CLhs, typename CRhs>
|
||||
[[nodiscard]] constexpr bool operator<(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator<(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) noexcept {
|
||||
return lhs.index() > rhs.index();
|
||||
}
|
||||
|
||||
template<typename CLhs, typename CRhs>
|
||||
[[nodiscard]] constexpr bool operator>(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator>(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) noexcept {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
|
||||
template<typename CLhs, typename CRhs>
|
||||
[[nodiscard]] constexpr bool operator<=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator<=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) noexcept {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
template<typename CLhs, typename CRhs>
|
||||
[[nodiscard]] constexpr bool operator>=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator>=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) noexcept {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
@@ -175,37 +175,37 @@ public:
|
||||
constexpr extended_storage_iterator(const extended_storage_iterator<It, Args...> &other)
|
||||
: it{other.it} {}
|
||||
|
||||
constexpr extended_storage_iterator &operator++() ENTT_NOEXCEPT {
|
||||
constexpr extended_storage_iterator &operator++() noexcept {
|
||||
return ++std::get<It>(it), (++std::get<Other>(it), ...), *this;
|
||||
}
|
||||
|
||||
constexpr extended_storage_iterator operator++(int) ENTT_NOEXCEPT {
|
||||
constexpr extended_storage_iterator operator++(int) noexcept {
|
||||
extended_storage_iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr pointer operator->() const noexcept {
|
||||
return operator*();
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr reference operator*() const noexcept {
|
||||
return {*std::get<It>(it), *std::get<Other>(it)...};
|
||||
}
|
||||
|
||||
template<typename... CLhs, typename... CRhs>
|
||||
friend constexpr bool operator==(const extended_storage_iterator<CLhs...> &, const extended_storage_iterator<CRhs...> &) ENTT_NOEXCEPT;
|
||||
friend constexpr bool operator==(const extended_storage_iterator<CLhs...> &, const extended_storage_iterator<CRhs...> &) noexcept;
|
||||
|
||||
private:
|
||||
std::tuple<It, Other...> it;
|
||||
};
|
||||
|
||||
template<typename... CLhs, typename... CRhs>
|
||||
[[nodiscard]] constexpr bool operator==(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) noexcept {
|
||||
return std::get<0>(lhs.it) == std::get<0>(rhs.it);
|
||||
}
|
||||
|
||||
template<typename... CLhs, typename... CRhs>
|
||||
[[nodiscard]] constexpr bool operator!=(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ public:
|
||||
* @brief Move constructor.
|
||||
* @param other The instance to move from.
|
||||
*/
|
||||
basic_storage(basic_storage &&other) ENTT_NOEXCEPT
|
||||
basic_storage(basic_storage &&other) noexcept
|
||||
: base_type{std::move(other)},
|
||||
packed{std::move(other.packed)} {}
|
||||
|
||||
@@ -433,7 +433,7 @@ public:
|
||||
* @param other The instance to move from.
|
||||
* @param allocator The allocator to use.
|
||||
*/
|
||||
basic_storage(basic_storage &&other, const allocator_type &allocator) ENTT_NOEXCEPT
|
||||
basic_storage(basic_storage &&other, const allocator_type &allocator) noexcept
|
||||
: base_type{std::move(other), allocator},
|
||||
packed{container_type{std::move(other.packed.first()), allocator}, allocator} {
|
||||
ENTT_ASSERT(alloc_traits::is_always_equal::value || packed.second() == other.packed.second(), "Copying a storage is not allowed");
|
||||
@@ -449,7 +449,7 @@ public:
|
||||
* @param other The instance to move from.
|
||||
* @return This storage.
|
||||
*/
|
||||
basic_storage &operator=(basic_storage &&other) ENTT_NOEXCEPT {
|
||||
basic_storage &operator=(basic_storage &&other) noexcept {
|
||||
ENTT_ASSERT(alloc_traits::is_always_equal::value || packed.second() == other.packed.second(), "Copying a storage is not allowed");
|
||||
|
||||
shrink_to_size(0u);
|
||||
@@ -474,7 +474,7 @@ public:
|
||||
* @brief Returns the associated allocator.
|
||||
* @return The associated allocator.
|
||||
*/
|
||||
[[nodiscard]] constexpr allocator_type get_allocator() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr allocator_type get_allocator() const noexcept {
|
||||
return allocator_type{packed.second()};
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ public:
|
||||
* allocated space for.
|
||||
* @return Capacity of the storage.
|
||||
*/
|
||||
[[nodiscard]] size_type capacity() const ENTT_NOEXCEPT override {
|
||||
[[nodiscard]] size_type capacity() const noexcept override {
|
||||
return packed.first().size() * comp_traits::page_size;
|
||||
}
|
||||
|
||||
@@ -512,12 +512,12 @@ public:
|
||||
* @brief Direct access to the array of objects.
|
||||
* @return A pointer to the array of objects.
|
||||
*/
|
||||
[[nodiscard]] const_pointer raw() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_pointer raw() const noexcept {
|
||||
return packed.first().data();
|
||||
}
|
||||
|
||||
/*! @copydoc raw */
|
||||
[[nodiscard]] pointer raw() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer raw() noexcept {
|
||||
return packed.first().data();
|
||||
}
|
||||
|
||||
@@ -529,18 +529,18 @@ public:
|
||||
*
|
||||
* @return An iterator to the first instance of the internal array.
|
||||
*/
|
||||
[[nodiscard]] const_iterator cbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterator cbegin() const noexcept {
|
||||
const auto pos = static_cast<typename iterator::difference_type>(base_type::size());
|
||||
return const_iterator{&packed.first(), pos};
|
||||
}
|
||||
|
||||
/*! @copydoc cbegin */
|
||||
[[nodiscard]] const_iterator begin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterator begin() const noexcept {
|
||||
return cbegin();
|
||||
}
|
||||
|
||||
/*! @copydoc begin */
|
||||
[[nodiscard]] iterator begin() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator begin() noexcept {
|
||||
const auto pos = static_cast<typename iterator::difference_type>(base_type::size());
|
||||
return iterator{&packed.first(), pos};
|
||||
}
|
||||
@@ -555,17 +555,17 @@ public:
|
||||
* @return An iterator to the element following the last instance of the
|
||||
* internal array.
|
||||
*/
|
||||
[[nodiscard]] const_iterator cend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterator cend() const noexcept {
|
||||
return const_iterator{&packed.first(), {}};
|
||||
}
|
||||
|
||||
/*! @copydoc cend */
|
||||
[[nodiscard]] const_iterator end() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterator end() const noexcept {
|
||||
return cend();
|
||||
}
|
||||
|
||||
/*! @copydoc end */
|
||||
[[nodiscard]] iterator end() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator end() noexcept {
|
||||
return iterator{&packed.first(), {}};
|
||||
}
|
||||
|
||||
@@ -578,17 +578,17 @@ public:
|
||||
*
|
||||
* @return An iterator to the first instance of the reversed internal array.
|
||||
*/
|
||||
[[nodiscard]] const_reverse_iterator crbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_reverse_iterator crbegin() const noexcept {
|
||||
return std::make_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
/*! @copydoc crbegin */
|
||||
[[nodiscard]] const_reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_reverse_iterator rbegin() const noexcept {
|
||||
return crbegin();
|
||||
}
|
||||
|
||||
/*! @copydoc rbegin */
|
||||
[[nodiscard]] reverse_iterator rbegin() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rbegin() noexcept {
|
||||
return std::make_reverse_iterator(end());
|
||||
}
|
||||
|
||||
@@ -602,17 +602,17 @@ public:
|
||||
* @return An iterator to the element following the last instance of the
|
||||
* reversed internal array.
|
||||
*/
|
||||
[[nodiscard]] const_reverse_iterator crend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_reverse_iterator crend() const noexcept {
|
||||
return std::make_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
/*! @copydoc crend */
|
||||
[[nodiscard]] const_reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_reverse_iterator rend() const noexcept {
|
||||
return crend();
|
||||
}
|
||||
|
||||
/*! @copydoc rend */
|
||||
[[nodiscard]] reverse_iterator rend() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rend() noexcept {
|
||||
return std::make_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
@@ -626,12 +626,12 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return The object assigned to the entity.
|
||||
*/
|
||||
[[nodiscard]] const value_type &get(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const value_type &get(const entity_type entt) const noexcept {
|
||||
return element_at(base_type::index(entt));
|
||||
}
|
||||
|
||||
/*! @copydoc get */
|
||||
[[nodiscard]] value_type &get(const entity_type entt) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] value_type &get(const entity_type entt) noexcept {
|
||||
return const_cast<value_type &>(std::as_const(*this).get(entt));
|
||||
}
|
||||
|
||||
@@ -640,12 +640,12 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return The object assigned to the entity as a tuple.
|
||||
*/
|
||||
[[nodiscard]] std::tuple<const value_type &> get_as_tuple(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] std::tuple<const value_type &> get_as_tuple(const entity_type entt) const noexcept {
|
||||
return std::forward_as_tuple(get(entt));
|
||||
}
|
||||
|
||||
/*! @copydoc get_as_tuple */
|
||||
[[nodiscard]] std::tuple<value_type &> get_as_tuple(const entity_type entt) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] std::tuple<value_type &> get_as_tuple(const entity_type entt) noexcept {
|
||||
return std::forward_as_tuple(get(entt));
|
||||
}
|
||||
|
||||
@@ -734,12 +734,12 @@ public:
|
||||
*
|
||||
* @return An iterable object to use to _visit_ the storage.
|
||||
*/
|
||||
[[nodiscard]] iterable each() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterable each() noexcept {
|
||||
return {internal::extended_storage_iterator{base_type::begin(), begin()}, internal::extended_storage_iterator{base_type::end(), end()}};
|
||||
}
|
||||
|
||||
/*! @copydoc each */
|
||||
[[nodiscard]] const_iterable each() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterable each() const noexcept {
|
||||
return {internal::extended_storage_iterator{base_type::cbegin(), cbegin()}, internal::extended_storage_iterator{base_type::cend(), cend()}};
|
||||
}
|
||||
|
||||
@@ -787,14 +787,14 @@ public:
|
||||
* @brief Move constructor.
|
||||
* @param other The instance to move from.
|
||||
*/
|
||||
basic_storage(basic_storage &&other) ENTT_NOEXCEPT = default;
|
||||
basic_storage(basic_storage &&other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Allocator-extended move constructor.
|
||||
* @param other The instance to move from.
|
||||
* @param allocator The allocator to use.
|
||||
*/
|
||||
basic_storage(basic_storage &&other, const allocator_type &allocator) ENTT_NOEXCEPT
|
||||
basic_storage(basic_storage &&other, const allocator_type &allocator) noexcept
|
||||
: base_type{std::move(other), allocator} {}
|
||||
|
||||
/**
|
||||
@@ -802,13 +802,13 @@ public:
|
||||
* @param other The instance to move from.
|
||||
* @return This storage.
|
||||
*/
|
||||
basic_storage &operator=(basic_storage &&other) ENTT_NOEXCEPT = default;
|
||||
basic_storage &operator=(basic_storage &&other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Returns the associated allocator.
|
||||
* @return The associated allocator.
|
||||
*/
|
||||
[[nodiscard]] constexpr allocator_type get_allocator() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr allocator_type get_allocator() const noexcept {
|
||||
return allocator_type{base_type::get_allocator()};
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ public:
|
||||
*
|
||||
* @param entt A valid identifier.
|
||||
*/
|
||||
void get([[maybe_unused]] const entity_type entt) const ENTT_NOEXCEPT {
|
||||
void get([[maybe_unused]] const entity_type entt) const noexcept {
|
||||
ENTT_ASSERT(base_type::contains(entt), "Storage does not contain entity");
|
||||
}
|
||||
|
||||
@@ -835,7 +835,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return Returns an empty tuple.
|
||||
*/
|
||||
[[nodiscard]] std::tuple<> get_as_tuple([[maybe_unused]] const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] std::tuple<> get_as_tuple([[maybe_unused]] const entity_type entt) const noexcept {
|
||||
ENTT_ASSERT(base_type::contains(entt), "Storage does not contain entity");
|
||||
return std::tuple{};
|
||||
}
|
||||
@@ -888,12 +888,12 @@ public:
|
||||
*
|
||||
* @return An iterable object to use to _visit_ the storage.
|
||||
*/
|
||||
[[nodiscard]] iterable each() ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterable each() noexcept {
|
||||
return {internal::extended_storage_iterator{base_type::begin()}, internal::extended_storage_iterator{base_type::end()}};
|
||||
}
|
||||
|
||||
/*! @copydoc each */
|
||||
[[nodiscard]] const_iterable each() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] const_iterable each() const noexcept {
|
||||
return {internal::extended_storage_iterator{base_type::cbegin()}, internal::extended_storage_iterator{base_type::cend()}};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ class view_iterator<Type, std::index_sequence<AllOf...>, std::index_sequence<Any
|
||||
static constexpr std::size_t pool_count = sizeof...(AllOf) + sizeof...(AnyOf);
|
||||
using iterator_type = typename Type::const_iterator;
|
||||
|
||||
[[nodiscard]] bool valid() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool valid() const noexcept {
|
||||
return ((sizeof...(AllOf) != 0u) || (*it != tombstone)) && (std::get<AllOf>(pools)->contains(*it) && ...) && (!std::get<AnyOf>(pools)->contains(*it) && ...);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ public:
|
||||
using difference_type = typename iterator_type::difference_type;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
|
||||
constexpr view_iterator() ENTT_NOEXCEPT = default;
|
||||
constexpr view_iterator() noexcept = default;
|
||||
|
||||
view_iterator(iterator_type curr, iterator_type to, std::array<const Type *, pool_count> ref) ENTT_NOEXCEPT
|
||||
view_iterator(iterator_type curr, iterator_type to, std::array<const Type *, pool_count> ref) noexcept
|
||||
: it{curr},
|
||||
last{to},
|
||||
pools{ref} {
|
||||
@@ -55,26 +55,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
view_iterator &operator++() ENTT_NOEXCEPT {
|
||||
view_iterator &operator++() noexcept {
|
||||
while(++it != last && !valid()) {}
|
||||
return *this;
|
||||
}
|
||||
|
||||
view_iterator operator++(int) ENTT_NOEXCEPT {
|
||||
view_iterator operator++(int) noexcept {
|
||||
view_iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
|
||||
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer operator->() const noexcept {
|
||||
return &*it;
|
||||
}
|
||||
|
||||
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reference operator*() const noexcept {
|
||||
return *operator->();
|
||||
}
|
||||
|
||||
template<typename LhsType, typename... LhsArgs, typename RhsType, typename... RhsArgs>
|
||||
friend constexpr bool operator==(const view_iterator<LhsType, LhsArgs...> &, const view_iterator<RhsType, RhsArgs...> &) ENTT_NOEXCEPT;
|
||||
friend constexpr bool operator==(const view_iterator<LhsType, LhsArgs...> &, const view_iterator<RhsType, RhsArgs...> &) noexcept;
|
||||
|
||||
private:
|
||||
iterator_type it;
|
||||
@@ -83,12 +83,12 @@ private:
|
||||
};
|
||||
|
||||
template<typename LhsType, typename... LhsArgs, typename RhsType, typename... RhsArgs>
|
||||
[[nodiscard]] constexpr bool operator==(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) noexcept {
|
||||
return lhs.it == rhs.it;
|
||||
}
|
||||
|
||||
template<typename LhsType, typename... LhsArgs, typename RhsType, typename... RhsArgs>
|
||||
[[nodiscard]] constexpr bool operator!=(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
@@ -108,25 +108,25 @@ struct extended_view_iterator final {
|
||||
: it{from},
|
||||
pools{storage} {}
|
||||
|
||||
extended_view_iterator &operator++() ENTT_NOEXCEPT {
|
||||
extended_view_iterator &operator++() noexcept {
|
||||
return ++it, *this;
|
||||
}
|
||||
|
||||
extended_view_iterator operator++(int) ENTT_NOEXCEPT {
|
||||
extended_view_iterator operator++(int) noexcept {
|
||||
extended_view_iterator orig = *this;
|
||||
return ++(*this), orig;
|
||||
}
|
||||
|
||||
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reference operator*() const noexcept {
|
||||
return std::apply([entt = *it](auto *...curr) { return std::tuple_cat(std::make_tuple(entt), curr->get_as_tuple(entt)...); }, pools);
|
||||
}
|
||||
|
||||
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] pointer operator->() const noexcept {
|
||||
return operator*();
|
||||
}
|
||||
|
||||
template<typename... Lhs, typename... Rhs>
|
||||
friend bool constexpr operator==(const extended_view_iterator<Lhs...> &, const extended_view_iterator<Rhs...> &) ENTT_NOEXCEPT;
|
||||
friend bool constexpr operator==(const extended_view_iterator<Lhs...> &, const extended_view_iterator<Rhs...> &) noexcept;
|
||||
|
||||
private:
|
||||
It it;
|
||||
@@ -134,12 +134,12 @@ private:
|
||||
};
|
||||
|
||||
template<typename... Lhs, typename... Rhs>
|
||||
[[nodiscard]] constexpr bool operator==(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator==(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) noexcept {
|
||||
return lhs.it == rhs.it;
|
||||
}
|
||||
|
||||
template<typename... Lhs, typename... Rhs>
|
||||
[[nodiscard]] constexpr bool operator!=(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
|
||||
[[nodiscard]] constexpr bool operator!=(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class basic_view<Entity, get_t<Component...>, exclude_t<Exclude...>> {
|
||||
using storage_type = constness_as_t<typename storage_traits<Entity, std::remove_const_t<Comp>>::storage_type, Comp>;
|
||||
|
||||
template<std::size_t... Index>
|
||||
[[nodiscard]] auto opaque_set(std::index_sequence<Index...>) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto opaque_set(std::index_sequence<Index...>) const noexcept {
|
||||
std::size_t pos{};
|
||||
std::array<const base_type *, sizeof...(Component) + sizeof...(Exclude) - 1u> arr{};
|
||||
(static_cast<void>(std::get<Index>(pools) == view ? void() : void(arr[pos++] = std::get<Index>(pools))), ...);
|
||||
@@ -244,7 +244,7 @@ public:
|
||||
using iterable = iterable_adaptor<internal::extended_view_iterator<iterator, storage_type<Component>...>>;
|
||||
|
||||
/*! @brief Default constructor to use to create empty, invalid views. */
|
||||
basic_view() ENTT_NOEXCEPT
|
||||
basic_view() noexcept
|
||||
: pools{},
|
||||
filter{},
|
||||
view{} {}
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
* @param component The storage for the types to iterate.
|
||||
* @param epool The storage for the types used to filter the view.
|
||||
*/
|
||||
basic_view(storage_type<Component> &...component, storage_type<Exclude> &...epool) ENTT_NOEXCEPT
|
||||
basic_view(storage_type<Component> &...component, storage_type<Exclude> &...epool) noexcept
|
||||
: basic_view{std::forward_as_tuple(component...), std::forward_as_tuple(epool...)} {}
|
||||
|
||||
/**
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
* @param component The storage for the types to iterate.
|
||||
* @param epool The storage for the types used to filter the view.
|
||||
*/
|
||||
basic_view(std::tuple<storage_type<Component> &...> component, std::tuple<storage_type<Exclude> &...> epool = {}) ENTT_NOEXCEPT
|
||||
basic_view(std::tuple<storage_type<Component> &...> component, std::tuple<storage_type<Exclude> &...> epool = {}) noexcept
|
||||
: pools{std::apply([](auto &...curr) { return std::make_tuple(&curr...); }, component)},
|
||||
filter{std::apply([](auto &...curr) { return std::make_tuple(&curr...); }, epool)},
|
||||
view{std::apply([](const auto &...curr) { return (std::min)({&static_cast<const base_type &>(curr)...}, [](auto *lhs, auto *rhs) { return lhs->size() < rhs->size(); }); }, component)} {}
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
* @return A new view driven by the given component in its iterations.
|
||||
*/
|
||||
template<typename Comp>
|
||||
[[nodiscard]] basic_view use() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] basic_view use() const noexcept {
|
||||
basic_view other{*this};
|
||||
other.view = std::get<storage_type<Comp> *>(pools);
|
||||
return other;
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
* @return A new view driven by the given component in its iterations.
|
||||
*/
|
||||
template<std::size_t Comp>
|
||||
[[nodiscard]] basic_view use() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] basic_view use() const noexcept {
|
||||
basic_view other{*this};
|
||||
other.view = std::get<Comp>(pools);
|
||||
return other;
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
* @brief Returns the leading storage of a view.
|
||||
* @return The leading storage of the view.
|
||||
*/
|
||||
const base_type &handle() const ENTT_NOEXCEPT {
|
||||
const base_type &handle() const noexcept {
|
||||
return *view;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<typename Comp>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
return *std::get<storage_type<Comp> *>(pools);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<std::size_t Comp>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
return *std::get<Comp>(pools);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
* @brief Estimates the number of entities iterated by the view.
|
||||
* @return Estimated number of entities iterated by the view.
|
||||
*/
|
||||
[[nodiscard]] size_type size_hint() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size_hint() const noexcept {
|
||||
return view->size();
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator begin() const noexcept {
|
||||
return iterator{view->begin(), view->end(), opaque_set(std::index_sequence_for<Component...>{})};
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator end() const noexcept {
|
||||
return iterator{view->end(), view->end(), opaque_set(std::index_sequence_for<Component...>{})};
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ public:
|
||||
* @return The first entity of the view if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type front() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type front() const noexcept {
|
||||
const auto it = begin();
|
||||
return it != end() ? *it : null;
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public:
|
||||
* @return The last entity of the view if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type back() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type back() const noexcept {
|
||||
auto it = view->rbegin();
|
||||
for(const auto last = view->rend(); it != last && !contains(*it); ++it) {}
|
||||
return it == view->rend() ? null : *it;
|
||||
@@ -379,7 +379,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
[[nodiscard]] iterator find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator find(const entity_type entt) const noexcept {
|
||||
return contains(entt) ? iterator{view->find(entt), view->end(), opaque_set(std::index_sequence_for<Component...>{})} : end();
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ public:
|
||||
* @brief Checks if a view is properly initialized.
|
||||
* @return True if the view is properly initialized, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] explicit operator bool() const noexcept {
|
||||
return view != nullptr;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return True if the view contains the given entity, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool contains(const entity_type entt) const noexcept {
|
||||
return std::apply([entt](const auto *...curr) { return (curr->contains(entt) && ...); }, pools)
|
||||
&& std::apply([entt](const auto *...curr) { return (!curr->contains(entt) && ...); }, filter);
|
||||
}
|
||||
@@ -489,7 +489,7 @@ public:
|
||||
*
|
||||
* @return An iterable object to use to _visit_ the view.
|
||||
*/
|
||||
[[nodiscard]] iterable each() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterable each() const noexcept {
|
||||
return {internal::extended_view_iterator{begin(), pools}, internal::extended_view_iterator{end(), pools}};
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ public:
|
||||
* @return A more specific view.
|
||||
*/
|
||||
template<typename... Get, typename... Excl>
|
||||
[[nodiscard]] auto operator|(const basic_view<Entity, get_t<Get...>, exclude_t<Excl...>> &other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto operator|(const basic_view<Entity, get_t<Get...>, exclude_t<Excl...>> &other) const noexcept {
|
||||
using view_type = basic_view<Entity, get_t<Component..., Get...>, exclude_t<Exclude..., Excl...>>;
|
||||
return std::make_from_tuple<view_type>(std::apply([](auto *...curr) { return std::forward_as_tuple(*curr...); }, std::tuple_cat(pools, other.pools, filter, other.filter)));
|
||||
}
|
||||
@@ -556,7 +556,7 @@ public:
|
||||
using iterable = decltype(std::declval<storage_type>().each());
|
||||
|
||||
/*! @brief Default constructor to use to create empty, invalid views. */
|
||||
basic_view() ENTT_NOEXCEPT
|
||||
basic_view() noexcept
|
||||
: pools{},
|
||||
filter{},
|
||||
view{} {}
|
||||
@@ -565,14 +565,14 @@ public:
|
||||
* @brief Constructs a single-type view from a storage class.
|
||||
* @param ref The storage for the type to iterate.
|
||||
*/
|
||||
basic_view(storage_type &ref) ENTT_NOEXCEPT
|
||||
basic_view(storage_type &ref) noexcept
|
||||
: basic_view{std::forward_as_tuple(ref)} {}
|
||||
|
||||
/**
|
||||
* @brief Constructs a single-type view from a storage class.
|
||||
* @param ref The storage for the type to iterate.
|
||||
*/
|
||||
basic_view(std::tuple<storage_type &> ref, std::tuple<> = {}) ENTT_NOEXCEPT
|
||||
basic_view(std::tuple<storage_type &> ref, std::tuple<> = {}) noexcept
|
||||
: pools{&std::get<0>(ref)},
|
||||
filter{},
|
||||
view{&std::get<0>(ref)} {}
|
||||
@@ -581,7 +581,7 @@ public:
|
||||
* @brief Returns the leading storage of a view.
|
||||
* @return The leading storage of the view.
|
||||
*/
|
||||
const base_type &handle() const ENTT_NOEXCEPT {
|
||||
const base_type &handle() const noexcept {
|
||||
return *view;
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<typename Comp = Component>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
static_assert(std::is_same_v<Comp, Component>, "Invalid component type");
|
||||
return *std::get<0>(pools);
|
||||
}
|
||||
@@ -602,7 +602,7 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<std::size_t Comp>
|
||||
[[nodiscard]] decltype(auto) storage() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] decltype(auto) storage() const noexcept {
|
||||
return *std::get<Comp>(pools);
|
||||
}
|
||||
|
||||
@@ -610,7 +610,7 @@ public:
|
||||
* @brief Returns the number of entities that have the given component.
|
||||
* @return Number of entities that have the given component.
|
||||
*/
|
||||
[[nodiscard]] size_type size() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] size_type size() const noexcept {
|
||||
return view->size();
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ public:
|
||||
* @brief Checks whether a view is empty.
|
||||
* @return True if the view is empty, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool empty() const noexcept {
|
||||
return view->empty();
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator begin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator begin() const noexcept {
|
||||
return view->begin();
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the entity following the last entity of the view.
|
||||
*/
|
||||
[[nodiscard]] iterator end() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator end() const noexcept {
|
||||
return view->end();
|
||||
}
|
||||
|
||||
@@ -655,7 +655,7 @@ public:
|
||||
*
|
||||
* @return An iterator to the first entity of the reversed view.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rbegin() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rbegin() const noexcept {
|
||||
return view->rbegin();
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ public:
|
||||
* @return An iterator to the entity following the last entity of the
|
||||
* reversed view.
|
||||
*/
|
||||
[[nodiscard]] reverse_iterator rend() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] reverse_iterator rend() const noexcept {
|
||||
return view->rend();
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ public:
|
||||
* @return The first entity of the view if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type front() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type front() const noexcept {
|
||||
return empty() ? null : *begin();
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ public:
|
||||
* @return The last entity of the view if one exists, the null entity
|
||||
* otherwise.
|
||||
*/
|
||||
[[nodiscard]] entity_type back() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] entity_type back() const noexcept {
|
||||
return empty() ? null : *rbegin();
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ public:
|
||||
* @return An iterator to the given entity if it's found, past the end
|
||||
* iterator otherwise.
|
||||
*/
|
||||
[[nodiscard]] iterator find(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterator find(const entity_type entt) const noexcept {
|
||||
return contains(entt) ? view->find(entt) : end();
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ public:
|
||||
* @brief Checks if a view is properly initialized.
|
||||
* @return True if the view is properly initialized, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] explicit operator bool() const noexcept {
|
||||
return view != nullptr;
|
||||
}
|
||||
|
||||
@@ -733,7 +733,7 @@ public:
|
||||
* @param entt A valid identifier.
|
||||
* @return True if the view contains the given entity, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool contains(const entity_type entt) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] bool contains(const entity_type entt) const noexcept {
|
||||
return view->contains(entt);
|
||||
}
|
||||
|
||||
@@ -815,7 +815,7 @@ public:
|
||||
*
|
||||
* @return An iterable object to use to _visit_ the view.
|
||||
*/
|
||||
[[nodiscard]] iterable each() const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] iterable each() const noexcept {
|
||||
return std::get<0>(pools)->each();
|
||||
}
|
||||
|
||||
@@ -827,7 +827,7 @@ public:
|
||||
* @return A more specific view.
|
||||
*/
|
||||
template<typename... Get, typename... Excl>
|
||||
[[nodiscard]] auto operator|(const basic_view<Entity, get_t<Get...>, exclude_t<Excl...>> &other) const ENTT_NOEXCEPT {
|
||||
[[nodiscard]] auto operator|(const basic_view<Entity, get_t<Get...>, exclude_t<Excl...>> &other) const noexcept {
|
||||
using view_type = basic_view<Entity, get_t<Component, Get...>, exclude_t<Excl...>>;
|
||||
return std::make_from_tuple<view_type>(std::apply([this](auto *...curr) { return std::forward_as_tuple(*std::get<0>(pools), *curr...); }, std::tuple_cat(other.pools, other.filter)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user