What is C++ version of realloc(), to allocate the new buffer and copy the contents from the old one?
There’s no new/delete equivalent of realloc in C++. From Bjarne Stroustrup’s FAQ : Why doesn’t C++ have an equivalent to realloc()? If you want to, you can of course use realloc(). However, realloc() is only guaranteed to work on arrays allocated by malloc() (and similar functions) containing objects without user-defined copy constructors. Also, please remember … Read more