Number Iterator¶
| Spice | |
|---|---|
NumberIterator<N> struct¶
Implements: IIterator<N>
A NumberIterator in Spice can be used to iterate over a range of numbers
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct a number iterator over the inclusive range [lowerBound, upperBound]
Parameters
| Name | Type | Description |
|---|---|---|
lowerBound |
N |
Inclusive lower bound of the range |
upperBound |
N |
Inclusive upper bound of the range |
Methods¶
get¶
| Spice | |
|---|---|
Returns the current number of the number range
Returns: N& — Reference to the current number
getIdx¶
| Spice | |
|---|---|
Returns the current index and the current number of the number range
Returns: Pair<unsigned long, N&> — Pair of current index and a reference to the current number
isValid¶
| Spice | |
|---|---|
Check if the iterator is valid
Returns: bool — true or false
next¶
| Spice | |
|---|---|
Returns the current number of the number range and moves the cursor to the next item
Functions¶
range¶
| Spice | |
|---|---|
Convenience wrapper for creating a simple number iterator
Parameters
| Name | Type | Description |
|---|---|---|
begin |
N |
|
end |
N |
Returns: NumberIterator<N>
Operators¶
operator++¶
| Spice | |
|---|---|
Advances the cursor by one
Parameters
| Name | Type | Description |
|---|---|---|
it |
NumberIterator<N>& |
NumberIterator |
operator--¶
| Spice | |
|---|---|
Move the cursor back by one
Parameters
| Name | Type | Description |
|---|---|---|
it |
NumberIterator<N>& |
NumberIterator |
operator+=¶
| Spice | |
|---|---|
Advances the cursor by the given offset
Parameters
| Name | Type | Description |
|---|---|---|
it |
NumberIterator<N>& |
NumberIterator |
offset |
N |
Offset |
operator-=¶
| Spice | |
|---|---|
Move the cursor back by the given offset
Parameters
| Name | Type | Description |
|---|---|---|
it |
NumberIterator<N>& |
NumberIterator |
offset |
N |
Offset |