COMS W4995 C++ Deep Dive for C Programmers

Dynamically Growable Array

Lecture Outline

  1. How IntArray::push_back() works

    • Time complexity: amortized O(1)
  2. Code walk-through

    • =delete & =default
    • push_back() function implementation
    • std::copy() and the pattern of specifying [begin, end) range
    • main() and operator<<()
  3. Fixing some subtle issues

    • providing strong exception guarantee
    • using member initializer list
    • order of member initialization