Learn how iterators are special elements of software that allow the programmer to manipulate containers in a diverse number of ways, and how typically an iterator seeks to hide the underlying container's implementation mechanism; for example, a function that returns the last element in a container, not caring if the container is a linked list or a static array.
- [Instructor] Up to this point, I've been referring…to how some containers support some types of access.…This access of data stored in containers…is often performed by iterators.…Iterators are objects that enable us to traverse containers…in some order for either reading or writing.…Now, you may already be familiar with this operation,…as you surely have read or written data in arrays…or any other containers.…
However, iterators in the C++ STL are defined as templates,…and they must comply with a very specific set of rules…in order to qualify as one of many types of iterators.…So this brings us to the question,…are pointers and iterators the same thing?…Well, no,…pointers are variables that can be indirected…to refer to some memory location.…A pointer, however,…meets the requirements for many types of iterators,…and so we can safely say…that pointers are a type of iterator.…
The same happens with integers…when acting as indexes to arrays.…These integers are indeed iterators…for that particular application,…but they are essentially discrete numeric variables.…
- Why the STL is important
- Containers and iterators
- Vectors and lists
- Stacks and dequeues
- Associative containers
Skill Level Advanced
1. The Standard Template Library
2. Vectors and Lists
3. Stacks, Queues, and Deques
4. Associative Containers
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.