From 4998e90870b11b04bc4d04fe18517da20a9537fd Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 22 Mar 2023 10:31:59 +0100 Subject: [PATCH] doc: minor changes --- src/entt/entity/group.hpp | 8 -------- src/entt/entity/sparse_set.hpp | 11 +++-------- src/entt/entity/view.hpp | 28 ++++++++-------------------- 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index f754a3749..97c11de18 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -582,10 +582,6 @@ public: /** * @brief Sort a group according to the given comparison function. * - * Sort the group so that iterating it with a couple of iterators returns - * entities and components in the expected order. See `begin` and `end` for - * more details. - * * The comparison function object must return `true` if the first element * is _less_ than the second one, `false` otherwise. The signature of the * comparison function should be equivalent to one of the following: @@ -982,10 +978,6 @@ public: /** * @brief Sort a group according to the given comparison function. * - * Sort the group so that iterating it with a couple of iterators returns - * entities and components in the expected order. See `begin` and `end` for - * more details. - * * The comparison function object must return `true` if the first element * is _less_ than the second one, `false` otherwise. The signature of the * comparison function should be equivalent to one of the following: diff --git a/src/entt/entity/sparse_set.hpp b/src/entt/entity/sparse_set.hpp index 819a00ca5..91b6f76de 100644 --- a/src/entt/entity/sparse_set.hpp +++ b/src/entt/entity/sparse_set.hpp @@ -956,14 +956,9 @@ public: * @brief Sort entities according to their order in another sparse set. * * Entities that are part of both the sparse sets are ordered internally - * according to the order they have in `other`. All the other entities goes - * to the end of the list and there are no guarantees on their order.
- * In other terms, this function can be used to impose the same order on two - * sets by using one of them as a master and the other one as a slave. - * - * Iterating the sparse set with a couple of iterators returns elements in - * the expected order after a call to `sort_as`. See `begin` and `end` for - * more details. + * according to the order they have in `other`.
+ * All the other entities goes to the end of the list and there are no + * guarantees on their order. * * @param other The sparse sets that imposes the order of the entities. */ diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index e5ef42ffc..a2bb70eda 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -453,9 +453,7 @@ public: /** * @brief Returns the components assigned to the given entity. * - * @warning - * Attempting to use an entity that doesn't belong to the view results in - * undefined behavior. + * @sa get * * @tparam Index Indexes of the components to get. * @param entt A valid identifier. @@ -757,33 +755,23 @@ public: * Attempting to use an entity that doesn't belong to the view results in * undefined behavior. * - * @tparam Type Type of the component to get. + * @tparam Elem Type or index of the component to get. * @param entt A valid identifier. * @return The component assigned to the entity. */ - template + template [[nodiscard]] decltype(auto) get(const entity_type entt) const { - static_assert(std::is_same_v, typename Get::value_type>, "Invalid component type"); + static_assert(std::is_same_v, typename Get::value_type>, "Invalid component type"); return get<0>(entt); } - /** - * @brief Returns the component assigned to the given entity. - * - * @warning - * Attempting to use an entity that doesn't belong to the view results in - * undefined behavior. - * - * @tparam Index Index of the component to get. - * @param entt A valid identifier. - * @return The component assigned to the entity. - */ - template + /*! @copydoc get */ + template [[nodiscard]] decltype(auto) get(const entity_type entt) const { - if constexpr(sizeof...(Index) == 0) { + if constexpr(sizeof...(Elem) == 0) { return storage().get_as_tuple(entt); } else { - return storage().get(entt); + return storage().get(entt); } }