class
#include <mywheel/array_like.hpp>
Iterator The code defines an iterator class for a repeat array, allowing iteration over the elements of the array.
Constructors, destructors, conversion operators
- Iterator(const RepeatArray<T>& array, size_t count)
Public functions
- auto operator!=(const Iterator& other) const -> bool
- auto operator*() const -> const T&
- auto operator++() -> Iterator&
Function documentation
RepeatArray:: Iterator:: Iterator(const RepeatArray<T>& array,
size_t count)
Parameters | |
---|---|
array in | Reference to the RepeatArray to iterate over. |
count in | Current position in the iteration. |
Constructor for the Iterator class.
Initializes an Iterator instance with a reference to the RepeatArray it will iterate over, and a count representing the current position in the iteration.
bool RepeatArray:: Iterator:: operator!=(const Iterator& other) const
Parameters | |
---|---|
other in | Iterator to compare to. |
Returns | True if the counts are not equal, false otherwise. |
Compares two Iterator instances for inequality.
This operator overload checks if the current count of this Iterator is not equal to the count of the other Iterator passed in.
const T& RepeatArray:: Iterator:: operator*() const
Returns | The value stored in the underlying RepeatArray. |
---|
Returns the value stored in the underlying RepeatArray.
This overloads the dereference operator for the Iterator class. It returns the value stored in the RepeatArray that this Iterator is iterating over.
Iterator& RepeatArray:: Iterator:: operator++()
Returns | The iterator object itself is being returned. |
---|
Pre-increment operator overload for Iterator class.
Increments the internal count variable and returns a reference to self.