File non_zero_index_forward_iterator.hpp

Functions

template<typename Iterator>
static inline NonZeroIndexForwardIterator<Iterator> make_non_zero_index_forward_iterator(Iterator begin, Iterator end)

Creates and returns a new NonZeroIndexForwardIterator.

Template Parameters:

Iterator – The type of the iterator to be adapted

Parameters:
  • begin – An iterator to the beginning of the values

  • end – An iterator to the end of the values

Returns:

A NonZeroIndexForwardIterator that has been created

template<typename Iterator>
class NonZeroIndexForwardIterator
#include <non_zero_index_forward_iterator.hpp>

An iterator adaptor that adapts an iterator, which provides access to a fixed number of values, such that it acts as a forward iterator that returns the indices of all non-zero values.

Template Parameters:

Iterator – The type of the iterator to be adapted

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::forward_iterator_tag iterator_category

The tag that specifies the capabilities of the iterator.

Public Functions

inline NonZeroIndexForwardIterator(Iterator begin, Iterator end)
Parameters:
  • begin – An iterator to the beginning of the values

  • end – An iterator to the end of the values

inline reference operator*() const

Returns the element, the iterator currently refers to.

Returns:

The element, the iterator currently refers to

inline NonZeroIndexForwardIterator<Iterator> &operator++()

Returns an iterator to the next element.

Returns:

A reference to an iterator that refers to the next element

inline NonZeroIndexForwardIterator<Iterator> &operator++(int n)

Returns an iterator to the next element.

Returns:

A reference to an iterator that refers to the next element

inline bool operator!=(const NonZeroIndexForwardIterator<Iterator> &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

inline bool operator==(const NonZeroIndexForwardIterator<Iterator> &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

Private Members

Iterator iterator_
Iterator end_
uint32 index_