W5: CONTAINERS + ITERATORS Flashcards

1
Q

W5-Q1: The STL inludes adapters for converting a container class to operate in a specific context. The adaptors include?

A

_ stack - last in, first out (LIFO) context
_ queue - first in, first out (FIFO) context
_ priority_queue - first element is always the greatest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

W5-Q2: What is an ITERATOR?

A

_ 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly