Object-Oriented Programming (OOP) Lecture 42: Iterators and Their Categories, Slides of Object Oriented Programming

An in-depth exploration of iterators in object-oriented programming (oop), their definitions, and categories, including input iterators, output iterators, forward iterators, bidirectional iterators, and random-access iterators. Understand their capabilities and container compatibility.

Typology: Slides

2011/2012

Uploaded on 11/09/2012

bacha
bacha 🇮🇳

4.3

(41)

213 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Object-Oriented Programming
(OOP)
Lecture No. 42
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Object-Oriented Programming (OOP) Lecture 42: Iterators and Their Categories and more Slides Object Oriented Programming in PDF only on Docsity!

Object-Oriented Programming

(OOP)

Lecture No. 42

Iterators

  • Iterators are types defined by STL
  • Iterators are for containers like pointers are for ordinary data structures
  • STL iterators provide pointer operations such as * and ++

Input Iterators

  • Can only read an element
  • Can only move in forward direction one element at a time
  • Support only one-pass algorithms

Output Iterators

  • Can only write an element
  • Can only move in forward direction one element at a time
  • Support only one-pass algorithms

Bidirectional Iterators

  • Provide all the capabilities of forward iterators
  • In addition, they can move in backward direction
  • As a result they support multi-pass algorithms

Random Access Iterators

  • Provide all the capabilities of bidirectional iterators
  • In addition they can directly access any element of a container

Container and Iterator Types

  • Sequence Containers -- vector -- random access -- deque -- random access -- list -- bidirectional
  • Associative Containers -- set -- bidirectional -- multiset -- bidirectional -- map -- bidirectional -- multimap -- bidirectional

…Container and Iterator Types

  • Container Adapters

-- stack -- (none) -- queue -- (none) -- priority_queue -- (none)