5.1.1 Pairs and Iterators

Now we are going to start to look at associative data structures. Unlike vectors, stacks, and queues, associative data structures are not stored in a particular order and cannot be accessed in an orderly fashion. Instead, they are accessed through keys and values as opposed to an index.

You can also access all the elements in an associative data structure by iterating through them, however since there is no index to access the values, you need to access in a different way using an iterator.

In this lesson, you are going to get a quick introduction to two elements that will be used to help with access to these associative data structures, pairs and iterators. You will then use these as you explore sets and maps later.

Last updated