pike.git / CHANGES

version» Context lines:

pike.git/CHANGES:77:    As noted above, an iterator interface has been added that is now    used in various places to iterate over different data structures.    Not only the built-in data types are supported, but actually any    object that fulfills the interface for iterators:       When iterating over an object o, o->_get_iterator() is called to    get an iterator object. An iterator object should at least have    two functions, index() and value(), to get the index and value    at the current position, a function `+=(int steps) to advance the    current position the specified number of steps, and a `!() that -  returns zero if the position hasn't reached the end of the data set. +  returns zero if the end of the data set hasn't been reached yet.       Also, if the object o lacks a _get_iterator function, it's assumed    to be an iterator itself. This makes it possible to pass an    iterator explicitly to e.g. the foreach statement.       The built-in data types also have iterator classes with this    interface. They are found as Array.Iterator, Mapping.Iterator, etc    and can be used to iterate over these data types in some custom    fashion. This is especially useful for mappings and multisets,    which cannot be iterated over directly in any other way. For