Skip to content

Commit a846ee7

Browse files
committed
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().
1 parent 2a89bb2 commit a846ee7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

AK/Vector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class VectorIterator {
5050
int operator-(const VectorIterator& other) { return m_index - other.m_index; }
5151

5252
bool is_end() const { return m_index == m_vector.size(); }
53+
int index() const { return m_index; }
5354

5455
private:
5556
friend VectorType;

0 commit comments

Comments
 (0)