From a846ee76eaf9233fac0e1c0e73eb94aa7a8d122b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 4 Aug 2019 20:17:55 +0200 Subject: [PATCH] AK: Add VectorIterator::index() A simple helper function that extracts the index of an iterator. Note that the index is not valid if the iterator is end(). --- AK/Vector.h | 1 + 1 file changed, 1 insertion(+) diff --git a/AK/Vector.h b/AK/Vector.h index 554da28431..7daf6c54d8 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -50,6 +50,7 @@ public: int operator-(const VectorIterator& other) { return m_index - other.m_index; } bool is_end() const { return m_index == m_vector.size(); } + int index() const { return m_index; } private: friend VectorType;