From fc86b2a9473179a3069219a8f735d6812322daee Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 15 Feb 2024 17:53:49 +0100 Subject: [PATCH] use Vec::indexOfPtr --- Base/Types/OwningVector.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Base/Types/OwningVector.h b/Base/Types/OwningVector.h index f72a9c388c2..199fd73a102 100644 --- a/Base/Types/OwningVector.h +++ b/Base/Types/OwningVector.h @@ -19,6 +19,7 @@ #define BORNAGAIN_BASE_TYPES_OWNINGVECTOR_H #include "Base/Util/Assert.h" +#include "Base/Util/Vec.h" #include <algorithm> #include <cstddef> #include <utility> @@ -59,13 +60,7 @@ public: T* const& at(int i) const { return m_v.at(i); } T* const& front() const { return m_v.front(); } T* const& back() const { return m_v.back(); } - int index_of(const T* t) const - { - for (size_t i = 0; i < m_v.size(); i++) - if (m_v[i] == t) - return int(i); - return -1; - } + int index_of(const T* t) const { return Vec::indexOfPtr(t, m_v); } void delete_element(T* e) { -- GitLab