Lecture overview -- Keyboard shortcut: 'u'  Previous page: Iterators [Section] -- Keyboard shortcut: 'p'  Next page: Example uses of iterators - basis stuff -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 5 - Page 17 : 39
Notes about C++
Templates and The Standard Library
Iterators seen as generalized pointers

C++ iterators are modelled as generalized pointers

The pointer-related operators are used to manipulate iterators

  • The C++ Programming Language: Page 57, 550
 

 

  • Most important operators on iterators

    • The current element: * and ->

    • Go to the next element: ++

    • Equality ==

  • The start of a sequence s

    • s.begin()

  • The end of a sequence s

    • s.end()

    • Designates a non-existing one past the last element

  • Iterator validity

    • An iterator can only be used if it is valid

    • An iterator is invalid if it is non-intialized, points to the end, if the container has been destroyed, resized, ...