File iterator_binned.hpp

template<typename ValueType, typename IndexType = const uint32>
class BinnedIterator
#include <iterator_binned.hpp>

An iterator that provides access to the values of elements that are grouped into bins.

Template Parameters:
  • ValueType – The type of the values

  • IndexType – The type of the indices that assign elements to bins

Public Types

using difference_type = int

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

using value_type = ValueType

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

using pointer = ValueType*

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

using reference = ValueType&

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

using iterator_category = std::random_access_iterator_tag

The tag that specifies the capabilities of the iterator.

Public Functions

inline BinnedIterator(View<IndexType> binIndexView, View<ValueType> valueView, uint32 index)
Parameters:
  • binIndexView – A View that provides access to the indices that assign elements to bins

  • valueView – A View that provides access to the values

  • index – The index to start at

inline 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

inline reference operator[](uint32 index)

Returns the element at a specific index.

Parameters:

index – The index of the element to be returned

Returns:

The element at the given index

inline reference operator*() const

Returns the element, the iterator currently refers to.

Returns:

The element, the iterator currently refers to

inline reference operator*()

Returns the element, the iterator currently refers to.

Returns:

The element, the iterator currently refers to

inline BinnedIterator &operator++()

Returns an iterator to the next element.

Returns:

A reference to an iterator to the next element

inline BinnedIterator &operator++(int n)

Returns an iterator to the next element.

Returns:

A reference to an iterator to the next element

inline BinnedIterator &operator--()

Returns an iterator to the previous element.

Returns:

A reference to an iterator to the previous element

inline BinnedIterator &operator--(int n)

Returns an iterator to the previous element.

Returns:

A reference to an iterator to the previous element

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

inline difference_type operator-(const BinnedIterator &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

View<IndexType> binIndexView_
View<ValueType> valueView_
uint32 index_