Lesson 1
Today we'll talk about some fundamental ideas: interfaces, encodings, and implementations.
We'll also think about the promises data structures make.
And we'll talk about when an iterator ceases to be valid.
This lesson will be relevant to the following Group 6 learning goals:
- 6B (Using Iterators): Read and write C++ code using the standard C++
iterator
idiom, includingconst iterators
andconst_iterators
. - 6D (Iterator Validity): Explain why iterators can cease to be valid and identify common operations that cause iterators to no longer be valid.
Outline
- Before You Start
- What's an Interface?
- Practice: A List Interface
- What's an Encoding?
- What's an Implementation? Completed
- Specifying “The Rules”
At this point we'll change gears a bit and look at “the rules” for iterators. It's a good spot for a break.
- Iterator Rules
- Only Use Valid Iterators
- Example: An Iterator-Validity Violation
- Example: Another Iterator-Validity Violation
- Container-Specific Iterator-Validity Rules
- Key Points
- Before You Go…
To receive credit: complete all pages above, then this page will be complete as well (and get a green check emoji at the bottom right of the page).
(When logged in, completion status appears here.)