Topic: iterator

topics > computer science > programming > program control > Group: repetitive control

collection class
file input/output
foreach and for all statements
index sequence for array access
I/O streams
ordered data types
sequence generators


Generated for loops consist of an iteration variable and a co-routine generator function. The iteration variable is bound to successive values of the generator. Generators produces an order-dependent list while 'for all' statements generally produce an order-independent set. The generator consists of an initialization section, a next function, and a termination predicate. The generating function may be a set or list constructor providing the only access for that set or list. This allows sequential processing without an internal set or list representation. (cbb 5/80)
Subtopic: iterator up

Quote: iterated containers usually support the notions of a current element and resetting an iteration to the beginning
Quote: C# foreach for classes with IEnumerator, IEnumerable, and Changed event; invalidated on modification [»wiltS10_2000]
Quote: types of iterators: input or read-only, output or write-only, forward iterator or read-write, and random access [»koenA12_1995]
QuoteRef: shawM8_1976 ;;6 generator for iteration: provides initialization and next functions by extension whose base type is same as iteration variable
QuoteRef: shawM8_1976 ;;7 iteration variable is bound to each value of generator
QuoteRef: shawM8_1976 ;;7 Alphard: for x: gen (y) while predicate (x) do statement both generator and while clauses are optional

Subtopic: advantages of using an iterator up

Quote: using an iterator over all elements avoids using implementation details of the elements [»shawM3_1976]

Subtopic: processing a stream up

Quote: Programmers Assistant's plan building methods use structured programming constructs and composed loops which process streams of values [»wateRC1_1982]

Subtopic: bidirectional vs. random access iterators up

Quote: keep bidirectional iterators separate from random access iterators; e.g., different algorithms for rotate and random shuffle using these iterators

Subtopic: interruptible iterator up

Quote: interruptible iterators allow updates to the underlying collection; efficient, easier to use [»liuJ1_2006]

Subtopic: output iterator up

Quote: output iterators in the C++ Standard Library are difficult to specify; what is the relationship between value written, iterator, and algorithm? [»dosrG1_2006]

Subtopic: complex iterator up

Quote: in a complex iteration the repeated action varies with each iteration; needs programming language support [»zimmJA2_1981]

Subtopic: problems with iterators up

Quote: an iterator class and its container class need to cooperate when elements are added or removed while the iterator is active [»stroB_1991]

Related Topics up

Topic: collection class (11 items)
Topic: file input/output (21 items)
Topic: foreach and for all statements (16 items)
Topic: index sequence for array access (16 items)
Topic: I/O streams (17 items)
Topic: ordered data types (8 items)
Topic: sequence generators
(16 items)

Updated barberCB 6/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.