From 5724644653e43d05d62922792bbe57c25010c7bb Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 17 May 2024 12:27:06 +0200 Subject: [PATCH] organizer: mark functions [[nodiscard]] as needed --- src/entt/entity/organizer.hpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/entt/entity/organizer.hpp b/src/entt/entity/organizer.hpp index fd15d17cc..830a903ae 100644 --- a/src/entt/entity/organizer.hpp +++ b/src/entt/entity/organizer.hpp @@ -130,7 +130,7 @@ class basic_organizer final { } template - static std::size_t fill_dependencies(type_list, [[maybe_unused]] const type_info **buffer, [[maybe_unused]] const std::size_t count) { + [[nodiscard]] static std::size_t fill_dependencies(type_list, [[maybe_unused]] const type_info **buffer, [[maybe_unused]] const std::size_t count) { if constexpr(sizeof...(Type) == 0u) { return {}; } else { @@ -183,7 +183,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 noexcept { + [[nodiscard]] size_type ro_dependency(const type_info **buffer, const std::size_t length) const noexcept { return node.dependency(false, buffer, length); } @@ -194,7 +194,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 noexcept { + [[nodiscard]] size_type rw_dependency(const type_info **buffer, const std::size_t length) const noexcept { return node.dependency(true, buffer, length); } @@ -202,7 +202,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 noexcept { + [[nodiscard]] size_type ro_count() const noexcept { return node.ro_count; } @@ -210,7 +210,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 noexcept { + [[nodiscard]] size_type rw_count() const noexcept { return node.rw_count; } @@ -218,7 +218,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 noexcept { + [[nodiscard]] bool top_level() const noexcept { return in.empty(); } @@ -226,7 +226,7 @@ public: * @brief Returns a type info object associated with a vertex. * @return A properly initialized type info object. */ - const type_info &info() const noexcept { + [[nodiscard]] const type_info &info() const noexcept { return *node.info; } @@ -234,7 +234,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 noexcept { + [[nodiscard]] const char *name() const noexcept { return node.name; } @@ -242,7 +242,7 @@ public: * @brief Returns the function associated with a vertex. * @return The function associated with the vertex. */ - function_type *callback() const noexcept { + [[nodiscard]] function_type *callback() const noexcept { return node.callback; } @@ -250,7 +250,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 noexcept { + [[nodiscard]] const void *data() const noexcept { return node.payload; } @@ -258,7 +258,7 @@ public: * @brief Returns the list of in-edges of a vertex. * @return The list of in-edges of a vertex. */ - const std::vector &in_edges() const noexcept { + [[nodiscard]] const std::vector &in_edges() const noexcept { return in; } @@ -266,7 +266,7 @@ public: * @brief Returns the list of out-edges of a vertex. * @return The list of out-edges of a vertex. */ - const std::vector &out_edges() const noexcept { + [[nodiscard]] const std::vector &out_edges() const noexcept { return out; } @@ -274,7 +274,7 @@ public: * @brief Returns the list of nodes reachable from a given vertex. * @return The list of nodes reachable from the vertex. */ - [[deprecated("use ::out_edges")]] const std::vector &children() const noexcept { + [[deprecated("use ::out_edges")]] [[nodiscard]] const std::vector &children() const noexcept { return out_edges(); } @@ -385,7 +385,7 @@ public: * @brief Generates a task graph for the current content. * @return The adjacency list of the task graph. */ - std::vector graph() { + [[nodiscard]] std::vector graph() { std::vector adjacency_list{}; adjacency_list.reserve(vertices.size()); auto adjacency_matrix = builder.graph();