Containers and Iterators

So far, we've covered a lot of the fundamental tools C++ gives us, as well as some general principles of good programming design, in particular including the design of Abstract Data Types (ADTs).

We'll now look at various Container ADTs, which allow us to store and organize collections of other objects. Using container ADTs from the C++ standard library as examples:

  • A std::vector<double> could store datapoints for statistical analysis
  • A std::set<string> could represent uniqnames of students registered for a course
  • A std::map<string, double> could allow us to look up the price of an item on a menu by providing its name

If you're not familiar with all these containers, don't worry - we'll introduce each briefly today. throughout the rest of the course.

You may also have seen that EECS 280 is called "Programming and Introductory Data Structures". We're now entering the data structures portion of the course. If a container ADT specifies the interface for organizing information, the underlying implementation is a data structure. We'll consider several possible data structures and their pros/cons for various purposes, including efficiency analysis.

Updated Fall 2024

1: Introduction to Standard Library Containers




2: Sequential Containers with Contiguous Allocation




3: Sequential Containers with Linked Structures




4: Iterator Interfaces and Traversal by Iterator




5: The auto Keyword




6: Range-based for Loops




7: Sets and Maps
7.1 Not Started


7.1

Select the item below for participation credit.

You've reached the end of this lecture! Your work on any exercises will be saved if you re-open this page in the same web browser.

Participation Credit
Make sure to sign in to the page, complete each of the exercises, and double check the participation indicator at the top left of this page to ensure you've earned credit.