From 31cc1116ae73a4817b4e92b233b09be2dd2b4be7 Mon Sep 17 00:00:00 2001 From: Orange Date: Sun, 9 Nov 2025 14:05:46 +0300 Subject: [PATCH] Updates simplex iterator and size access Changes the index type for accessing simplex points to `std::size_t` for consistency and safety. Adds `[[nodiscard]]` attribute to `size()` and iterator functions to signal potential misuse and enable static analysis. These updates are part of the GJK algorithm implementation. --- include/omath/collision/simplex.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/omath/collision/simplex.hpp b/include/omath/collision/simplex.hpp index 23c9b25..20ca8de 100644 --- a/include/omath/collision/simplex.hpp +++ b/include/omath/collision/simplex.hpp @@ -34,20 +34,20 @@ namespace omath::collision m_size = std::min(m_size + 1, 4); } - Vector3& operator[](const int i) + Vector3& operator[](const std::size_t i) { return m_points[i]; } - size_t size() const + [[nodiscard]] std::size_t size() const { return m_size; } - auto begin() const + [[nodiscard]] auto begin() const { return m_points.begin(); } - auto end() const + [[nodiscard]] auto end() const { return m_points.end() - (4 - m_size); }