In C we used malloc(), free()
, but in C++ youare using new, delete
, but in C we also have realloc
, which will alloc the new block and
realloc
isn't used in C++ because C++ wants to use its copy and default constructors and destructors for things like this in general. But if you got plain old types that you want to handle as fast as possible, there is no reason not to roll your own array class that does what you want. I'm surprised there isn't one that's mostly STL-compatible already in the top Google page.