std::vector<CustomClass *> whatever(20000);
or
std::vector<CustomClass *> whatever; whatever.reserve(20000);
The first sets the actual size of the array - i.e. makes it a vector of 20,000 pointers. The latter leaves the vector blank, but leaves room for 20,000 pointers, so you can insert (up to) a lot without the need for redistribution.
You should probably know that the chances of it being really real are minimal.
Jerry Coffin Jul 12 2018-12-12T00: 00Z
source share