W5: CONTAINERS + ITERATORS Flashcards
W5-Q1: The STL inludes adapters for converting a container class to operate in a specific context. The adaptors include?
_ stack - last in, first out (LIFO) context
_ queue - first in, first out (FIFO) context
_ priority_queue - first element is always the greatest
W5-Q2: What is an ITERATOR?
_ An iterator is an object that points to an element in a sequence.
_ STL iterators simulate sequential access to elements of STL containers, similar to the access that raw pointers provide for elements of simple arrays.
_ Container classes that do not implement contiguous storage of elements require iterators to access their elements.
_ We use iterators to insert elements into a sequence or to remove them from a sequence.