CIS 29 - Notes for Thursday, 2/25

Announcements and Reminders


Recording

Standard Template Library (continued)

The list container

  • Double-ended linked list
  • Relatively efficient insert and delete operations
  • No index operator
  • Requires the <list> header file
Example 15-3 - the list container

Use of the list container in the bubble_pop game

The forward_list container

  • Single-ended linked list
  • Considered more efficient than a list container
  • Introduced in C++11
  • Requires the <forward_list> header file
Example 15-4 - the forward_list container

The deque container

  • Similar to vector and list containers
  • Index operator
  • Efficient insert/delete at the ends
  • Stored in non-contiguous memory
  • Requires the <deque> header file
Example 15-5 - the deque container

The queue adapter

  • Implements a FIFO (first in - first out) container using an underlying adaptation of another STL container
  • Elements of the queue are pushed on the back of the queue and popped off the front of the queue
  • Requires the <queue> header file
Example 15-6 - the queue adaptor

The priority_queue adapter

  • Implements a queue adapter in which the first element will be popped off first and remaining elements are assigned a priority based on a comparison function
  • Requires the <queue> header file
Example 15-7 - the priority_queue adaptor

The stack adapter

  • Implements a LIFO (last in - first out) container using an underlying adaptation of another STL container, a deque by default
  • Elements of the stack are pushed on to the top of the stack and also popped off the top
  • Requires the <stack> header file
Example 15-8 - the stack adaptor

The set container

  • associative container
  • elements are unique
  • elements stored in sorted order
  • requires <set> header file
Example 15-9 - the set container