Skip to content

Constant Iterator

Kamil Krauze edited this page Jan 19, 2024 · 7 revisions

Allocation

const_iterator()

Default constructor

const_iterator(PointerType ptr)

Copy constructor which assigns m_ptr to point at the m_data of stack_vector<T>.


Accessor operators

ReferenceType operator[](const size_t index)

Allows to index the array pointed at m_data.

PointerType operator->()

Returns m_ptr.

ReferenceType operator*()

Returns reference to 'm_ptr'.


Arithmetical operators

const_iterator& operator++()

Prefix increment m_ptr.

const_iterator operator++(int)

Postfix increment m_ptr.

const_iterator& operator--()

Prefix decrement m_ptr.

const_iterator operator--(int)

Postfix decrement m_ptr.

const_iterator& operator+=(const size_t val)

Allows for indexing the array easily.

const_iterator operator+(const size_t val)

Allows for indexing the array easily.

const_iterator& operator-=(const size_t val)

Allows for indexing the array easily.

const_iterator operator-(const size_t val)

Allows for indexing the array easily.


Relational Operators

bool operator==(const const_iterator& other)

If m_ptr value is the same as other m_ptr.

bool operator!=(const const_iterator& other)

If m_ptr value is not the same as other m_ptr.

bool operator>=(const const_iterator& other)

If m_ptr value is greater than or equal to other m_ptr.

bool operator<=(const const_iterator& other)

If m_ptr value is less than or equal to other m_ptr.

bool operator>(const const_iterator& other)

If m_ptr value is greater than to other m_ptr.

bool operator<(const const_iterator& other)

If m_ptr value is less than to other m_ptr.

Clone this wiki locally