Array Iterator¶
| Spice | |
|---|---|
ArrayIterator<I> struct¶
Implements: IIterator<I>
An ArrayIterator in Spice can be used to iterate over an arbitrary array
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct an array iterator over the given array
Parameters
| Name | Type | Description |
|---|---|---|
array |
I[] |
Array to iterate over |
size |
unsigned long |
Number of items in the array |
Methods¶
get¶
| Spice | |
|---|---|
Returns the current item of the array
Returns: I& — Reference to the current item
getIdx¶
| Spice | |
|---|---|
Returns the current index and the current item of the array
Returns: Pair<unsigned long, I&> — Pair of current index and reference to the current item
isValid¶
| Spice | |
|---|---|
Check if the iterator is valid
Returns: bool — true or false
next¶
| Spice | |
|---|---|
Returns the current item of the array and moves the cursor to the next one
Functions¶
iterate¶
| Spice | |
|---|---|
Convenience wrapper for creating a simple array iterator
Parameters
| Name | Type | Description |
|---|---|---|
array |
I[] |
|
size |
unsigned long |
Returns: ArrayIterator<I>
Operators¶
operator++¶
| Spice | |
|---|---|
Advances the cursor by one
Parameters
| Name | Type | Description |
|---|---|---|
it |
ArrayIterator<I>& |
ArrayIterator |
operator--¶
| Spice | |
|---|---|
Move the cursor back by one
Parameters
| Name | Type | Description |
|---|---|---|
it |
ArrayIterator<I>& |
ArrayIterator |
operator+=¶
| Spice | |
|---|---|
Advances the cursor by the given offset
Parameters
| Name | Type | Description |
|---|---|---|
it |
ArrayIterator<I>& |
ArrayIterator |
offset |
Numeric |
Offset |
operator-=¶
| Spice | |
|---|---|
Move the cursor back by the given offset
Parameters
| Name | Type | Description |
|---|---|---|
it |
ArrayIterator<I>& |
ArrayIterator |
offset |
Numeric |
Offset |