container

  • begin(), end()
  • rbegin(), rend()
  • size()

vector

Resizable array.

  • Constructor: vector(), vector(size), vector(size, fill)
  • push_back(val)
  • pop_back()

list

Implements double-linked list.

  • insert(it)

Insert before it. it == end(): insert at the end.

  • erase(it)

Erase item at it. Return item after it.

  • front(), back()

Easily access first & last element.

string

  • Constructor: string(size, fill)
  • length()
  • substr(begin), substr(begin, count)

Obtain a substring.

set / unordered_set

  • insert(val)
  • erase(val), erase(it)
  • find(val)

Return it, or end() if not found

  • count(val)
  • begin(), rbegin()

Access min/max element. set only.

map

  • insert(pair(key, val))
  • at(key)

Return val, throws if missing.

  • find(key)

Return it, or end() if not found