Blaze 3.9
Public Types | List of all members
blaze::InitializerIterator< Type > Class Template Reference

Implementation of an iterator for (extended) initializer lists. More...

#include <InitializerIterator.h>

Public Types

using IteratorCategory = std::random_access_iterator_tag
 The iterator category.
 
using ValueType = Type
 Type of the underlying elements.
 
using PointerType = const Type *
 Pointer return type.
 
using ReferenceType = const Type &
 Reference return type.
 
using DifferenceType = ptrdiff_t
 Difference between two iterators.
 
using iterator_category = IteratorCategory
 The iterator category.
 
using value_type = ValueType
 Type of the underlying elements.
 
using pointer = PointerType
 Pointer return type.
 
using reference = ReferenceType
 Reference return type.
 
using difference_type = DifferenceType
 Difference between two iterators.
 

Public Member Functions

Constructors
 InitializerIterator () noexcept
 Default constructor for the InitializerIterator class.
 
 InitializerIterator (size_t index, initializer_list< Type > list) noexcept
 Constructor for the InitializerIterator class. More...
 
 InitializerIterator (const InitializerIterator &)=default
 
Destructor
 ~InitializerIterator ()=default
 
Assignment operators
InitializerIteratoroperator+= (ptrdiff_t inc) noexcept
 Addition assignment operator. More...
 
InitializerIteratoroperator-= (ptrdiff_t dec) noexcept
 Subtraction assignment operator. More...
 
InitializerIteratoroperator= (const InitializerIterator &)=default
 
Increment/decrement operators
InitializerIteratoroperator++ () noexcept
 Pre-increment operator. More...
 
const InitializerIterator operator++ (int) noexcept
 Post-increment operator. More...
 
InitializerIteratoroperator-- () noexcept
 Pre-decrement operator. More...
 
const InitializerIterator operator-- (int) noexcept
 Post-decrement operator. More...
 
Access operators
ReferenceType operator[] (size_t index) const noexcept
 Direct access to the underlying elements. More...
 
ReferenceType operator* () const noexcept
 Direct access to the element at the current iterator position. More...
 
PointerType operator-> () const noexcept
 Direct access to the element at the current iterator position. More...
 

Utility functions

size_t index_
 Current index of the iterator within the initializer list.
 
initializer_list< Type > list_
 The initializer list to be traversed.
 
static const Type zero_ {}
 Neutral element for accesses to zero elements.
 
size_t index () const noexcept
 Low-level access to the underlying index member of the iterator. More...
 
initializer_list< Type > list () const noexcept
 Low-level access to the underlying list member of the iterator. More...
 

Detailed Description

template<typename Type>
class blaze::InitializerIterator< Type >

Implementation of an iterator for (extended) initializer lists.

The InitializerIterator represents a generic random-access iterator for (extended) initializer lists. It can be used for initializer lists representing dense vectors and specific rows of dense matrices.

Constructor & Destructor Documentation

◆ InitializerIterator()

template<typename Type >
blaze::InitializerIterator< Type >::InitializerIterator ( size_t  index,
initializer_list< Type >  list 
)
inlineexplicitnoexcept

Constructor for the InitializerIterator class.

Parameters
indexThe initial index of the iterator within the initializer list.
listThe initializer list to be traversed.

Member Function Documentation

◆ index()

template<typename Type >
size_t blaze::InitializerIterator< Type >::index
inlinenoexcept

Low-level access to the underlying index member of the iterator.

Returns
Index of the current iterator position.

◆ list()

template<typename Type >
initializer_list< Type > blaze::InitializerIterator< Type >::list
inlinenoexcept

Low-level access to the underlying list member of the iterator.

Returns
The underlying initializer list.

◆ operator*()

template<typename Type >
InitializerIterator< Type >::ReferenceType blaze::InitializerIterator< Type >::operator*
inlinenoexcept

Direct access to the element at the current iterator position.

Returns
The resulting value.

◆ operator++() [1/2]

template<typename Type >
InitializerIterator< Type > & blaze::InitializerIterator< Type >::operator++
inlinenoexcept

Pre-increment operator.

Returns
Reference to the incremented iterator.

◆ operator++() [2/2]

template<typename Type >
const InitializerIterator< Type > blaze::InitializerIterator< Type >::operator++ ( int  )
inlinenoexcept

Post-increment operator.

Returns
The previous position of the iterator.

◆ operator+=()

template<typename Type >
InitializerIterator< Type > & blaze::InitializerIterator< Type >::operator+= ( ptrdiff_t  inc)
inlinenoexcept

Addition assignment operator.

Parameters
incThe increment of the iterator.
Returns
The incremented iterator.

◆ operator--() [1/2]

template<typename Type >
InitializerIterator< Type > & blaze::InitializerIterator< Type >::operator--
inlinenoexcept

Pre-decrement operator.

Returns
Reference to the decremented iterator.

◆ operator--() [2/2]

template<typename Type >
const InitializerIterator< Type > blaze::InitializerIterator< Type >::operator-- ( int  )
inlinenoexcept

Post-decrement operator.

Returns
The previous position of the iterator.

◆ operator-=()

template<typename Type >
InitializerIterator< Type > & blaze::InitializerIterator< Type >::operator-= ( ptrdiff_t  dec)
inlinenoexcept

Subtraction assignment operator.

Parameters
decThe decrement of the iterator.
Returns
The decremented iterator.

◆ operator->()

template<typename Type >
InitializerIterator< Type >::PointerType blaze::InitializerIterator< Type >::operator->
inlinenoexcept

Direct access to the element at the current iterator position.

Returns
Pointer to the element at the current iterator position.

◆ operator[]()

template<typename Type >
InitializerIterator< Type >::ReferenceType blaze::InitializerIterator< Type >::operator[] ( size_t  index) const
inlinenoexcept

Direct access to the underlying elements.

Parameters
indexAccess index.
Returns
Reference to the accessed value.

The documentation for this class was generated from the following file: