Main Content

matlab::data::ForwardIterator<T>

Templated C++ class to provide forward iterator support for StructArray field names

Description

Use ForwardIterator objects to access a range of field name elements in a StructArray.

Class Details

Namespace:

matlab::data

Include:

ForwardIterator.hpp

Constructors

Copy Constructors

ForwardIterator(const ForwardIterator<T>& rhs)

Description

Creates a shared data copy of a ForwardIterator<T> object.

Parameters

const ForwardIterator<T>& rhs

Object to copy.

Returns

ForwardIterator

New instance.

Throws

None

Copy Assignment Operators

ForwardIterator<T>& operator=(const ForwardIterator<T>& rhs)

Description

Assigns a shared data copy to a ForwardIterator<T> object.

Parameters

const ForwardIterator<T>& rhs

Object to assign.

Returns

ForwardIterator<T>

Updated instance.

Throws

None

Other Operators

operator++

ForwardIterator<T>& operator++()

Description

Pre-increment operator.

Returns

ForwardIterator<T>&

Reference to updated value.

Throws

None

operator--

ForwardIterator<T> operator--(int)

Description

Post-increment operator.

Returns

ForwardIterator<T>

New object.

Throws

None

operator=

bool operator==(const ForwardIterator<T>& rhs) const

Parameters

const ForwardIterator<T>& rhs

Iterator to compare.

Returns

bool

Returns true if the iterators point to the same element. Otherwise, returns false.

Throws

None

operator!=

bool operator!=(const ForwardIterator<T>& rhs) const

Parameters

const ForwardIterator<T>& rhs

Iterator to compare.

Returns

bool

Returns true if this iterator points to a different element. Otherwise, returns false.

Throws

None

operator*

reference operator*() const

Returns

reference

Shared copy of element that iterator points to, specified as:

  • T& for arithmetic types.

  • Reference<T> for non-arithmetic types.

Throws

None

operator->

pointer operator->()

Returns

pointer

Pointer to element pointed to by this iterator, specified as:

  • T* for arithmetic types.

  • Reference<T>* for non-arithmetic types.

Throws

None

operator[]

reference operator[](const size_t& rhs) const

Description

Get a reference using a linear index.

Returns

reference

Element pointed to by this iterator, specified as typename iterator::reference.

Throws

None

Version History

Introduced in R2017b