Skip to main content
1 of 2
JDługosz
  • 11.7k
  • 19
  • 40
const int MIN_CAPACITY = 16;
const int GROWTH_FACTOR = 2;
const int SHRINK_FACTOR = 4;

these should be part of the class, not global variables that affect everything and pollute the namespace when your header is included.

And use constexpr now.


_data(new T[MIN_CAPACITY]

No naked new!

Use a unique_ptr<T[]> instead of a bare pointer for _data.

JDługosz
  • 11.7k
  • 19
  • 40