File index_iterator.hpp

class IndexIterator
#include <index_iterator.hpp>

An iterator that provides random read-only access to the indices in a continuous range.

Public Types

typedef int difference_type

The type that is used to represent the difference between two iterators.

typedef uint32 value_type

The type of the elements, the iterator provides access to.

typedef const uint32 *pointer

The type of a pointer to an element, the iterator provides access to.

typedef uint32 reference

The type of a reference to an element, the iterator provides access to.

typedef std::random_access_iterator_tag iterator_category

The tag that specifies the capabilities of the iterator.

Public Functions

IndexIterator()
IndexIterator(uint32 index)
Parameters:

index – The index to start with

reference operator[](uint32 index) const

Returns the element at a specific index.

Parameters:

index – The index of the element to be returned

Returns:

The element at the given index

reference operator*() const

Returns the element, the iterator currently refers to.

Returns:

The element, the iterator currently refers to

IndexIterator &operator++()

Returns an iterator to the next element.

Returns:

A reference to an iterator that refers to the next element

IndexIterator &operator++(int n)

Returns an iterator to the next element.

Returns:

A reference to an iterator that refers to the next element

IndexIterator &operator--()

Returns an iterator to the previous element.

Returns:

A reference to an iterator that refers to the previous element

IndexIterator &operator--(int n)

Returns an iterator to the previous element.

Returns:

A reference to an iterator that refers to the previous element

bool operator!=(const IndexIterator &rhs) const

Returns whether this iterator and another one refer to the same element.

Parameters:

rhs – A reference to another iterator

Returns:

True, if the iterators do not refer to the same element, false otherwise

bool operator==(const IndexIterator &rhs) const

Returns whether this iterator and another one refer to the same element.

Parameters:

rhs – A reference to another iterator

Returns:

True, if the iterators refer to the same element, false otherwise

difference_type operator-(const IndexIterator &rhs) const

Returns the difference between this iterator and another one.

Parameters:

rhs – A reference to another iterator

Returns:

The difference between the iterators

Private Members

uint32 index_