This class defines a simple iterator to be used to iterate single values (or complex objects where no iterator has been implemented yet)
More...
|
| | constructor (auto v) |
| | creates the single value iterator with the value passed as an argument More...
|
| |
| | copy () |
| | Creates a copy of the SingleValueIterator object, iterating the same object as the original and in the same position. More...
|
| |
| auto | getValue () |
| | returns the current value or throws an INVALID-ITERATOR exception if the iterator is invalid More...
|
| |
| bool | next () |
| | This method returns True and False alternately unless it has no value to iterate, in which case it returns only False. More...
|
| |
| | reset () |
| | Reset the iterator instance to its initial state. More...
|
| |
| bool | valid () |
| | returns True if the iterator is currently pointing at a valid element, False if not More...
|
| |
| abstract auto | getValue () |
| | returns the current value More...
|
| |
| abstract bool | next () |
| | Moves the current position to the next element; returns False if there are no more elements. More...
|
| |
| abstract bool | valid () |
| | returns True if the iterator is currently pointing at a valid element, False if not More...
|
| |
This class defines a simple iterator to be used to iterate single values (or complex objects where no iterator has been implemented yet)
- Since
- Qore 0.8.6
- Example: SingleValueIterator basic usage
auto val = 1;
SingleValueIterator it(val);
while (it.next()) {
printf("iter: %n\n", it.getValue());
}
iter: 1
Remember that input value is taken as a single token so result of the code above for a list as an input argument will be like this:
auto val = (1, 2, 3);
iter: list: (1, 2, 3)