File view_vector_indexed.hpp

template<typename IndexView, typename ValueView>
class IndexedVectorDecorator : public ViewDecorator<CompositeVector<IndexView, ValueView>>
#include <view_vector_indexed.hpp>

A vector that is backed by two one-dimensional views of a specific size, storing indices and corresponding values.

Template Parameters:
  • IndexView – The type of the view, the indices are backed by

  • ValueView – The type of the view, the values are backed by

Public Types

using index_type = typename IndexView::value_type

The type of the indices that are stored in the vector.

using value_type = typename ValueView::value_type

The type of the values that are stored in the vector.

Public Functions

inline explicit IndexedVectorDecorator(CompositeVector<IndexView, ValueView> &&view)
Parameters:

view – The view, the vector should be backed by

inline virtual ~IndexedVectorDecorator() override
inline uint32 getNumElements() const

Returns the number of elements in the vector.

Returns:

The number of elements in the vector

template<typename Vector>
class IterableIndexedVectorDecorator : public Vector<T>
#include <view_vector_indexed.hpp>

Provides access via iterators to indices and corresponding values stored in a vector.

Template Parameters:

Vector – The type of the vector

Public Types

using index_const_iterator = typename Vector::view_type::first_view_type::const_iterator

An iterator that provides read-only access to the indices stored in the vector.

using value_const_iterator = typename Vector::view_type::second_view_type::const_iterator

An iterator that provides read-only access to the values stored in the vector.

using index_iterator = typename Vector::view_type::first_view_type::iterator

An iterator that provides access to the indices stored in the vector and allows to modify them.

using value_iterator = typename Vector::view_type::second_view_type::iterator

An iterator that provides access to the values stored in the vector and allows to modify them.

Public Functions

inline explicit IterableIndexedVectorDecorator(typename Vector::view_type &&view)
Parameters:

view – The view, the vector should be backed by

inline virtual ~IterableIndexedVectorDecorator() override
inline index_const_iterator indices_cbegin() const

Returns an index_const_iterator to the beginning of the vector.

Returns:

An index_const_iterator to the beginning

inline index_const_iterator indices_cend() const

Returns an index_const_iterator to the end of the vector.

Returns:

An index_const_iterator to the end

inline value_const_iterator values_cbegin() const

Returns a value_const_iterator to the beginning of the vector.

Returns:

A value_const_iterator to the beginning

inline value_const_iterator values_cend() const

Returns a value_const_iterator to the end of the vector.

Returns:

A value_const_iterator to the end

inline index_iterator indices_begin()

Returns an index_iterator to the beginning of the vector.

Returns:

An index_iterator to the beginning

inline index_iterator indices_end()

Returns an index_iterator to the end of the vector.

Returns:

An index_iterator to the end

inline value_iterator values_begin()

Returns a value_iterator to the beginning of the vector.

Returns:

A value_iterator to the beginning

inline value_iterator values_end()

Returns a value_iterator to the end of the vector.

Returns:

A value_iterator to the end