class
#include <mywheel/array_like.hpp>
Iterator The code defines a class Iterator that allows iteration over elements in a ShiftArray.
Constructors, destructors, conversion operators
- Iterator(const ShiftArray<T>& array, size_t count)
Public functions
- auto operator!=(const Iterator& other) const -> bool
- auto operator*() const -> const T&
- auto operator++() -> Iterator&
Function documentation
ShiftArray:: Iterator:: Iterator(const ShiftArray<T>& array,
size_t count)
Parameters | |
---|---|
array in | The "array" parameter is of type "ShiftArray<T>", which is a template class representing an array that can be shifted (rotated) to the left or right. It is passed by reference to the constructor of the "Iterator" class. |
count in | The count parameter is of type size_t and represents the number of elements in the ShiftArray that the Iterator will iterate over. |
The Iterator constructor takes a ShiftArray object and a count as parameters.
bool ShiftArray:: Iterator:: operator!=(const Iterator& other) const
Parameters | |
---|---|
other in | The "other" parameter is a reference to another Iterator object. |
Returns | a boolean value. |
The function checks if the count of two iterators are not equal.
const T& ShiftArray:: Iterator:: operator*() const
Returns | The code is returning the element at the index array.start + count in the array.lst array. |
---|
The function returns the value at the current position in an array.
Iterator& ShiftArray:: Iterator:: operator++()
Returns | The iterator object itself is being returned. |
---|
The above function overloads the pre-increment operator for an Iterator class, incrementing the count variable and returning a reference to the updated object.