Q:

Is there a realloc equivalent in C++?

In C, we have malloc(), free(), and realloc().  In C++ we have new(), delete() and their array versions.  Is there a C++ realloc function?  I'm implementing some low level stuff in embedded land and just realized there was no realloc function to pair up with the C++ functions and wanted to make sure I wasn't missing anything.  I'm guessing "placement new" into a new, separate buffer is the closest match, but wanted to be sure.
Restating the question a bit as I'm getting some answer a bit far afield.
I have implemented device level malloc/new/realloc/etc. functions on my embedded device and wanted to double check to be sure there was no C++ realloc type function that I was unaware of. 

A:

No, there is no direct equivalent.  You would have to do the implementation yourself.  Since a class really shouldn't change its size, this isn't really an issue.  Move semantics can handle most of these cases.
However, there are some classes that use header info + tail end allocated data.  To code these 'properly' you would have to override the operator new() and operator delete() function for the class to handle this additional 'flexible' data.  How you 'reallocate' the data is specific to your needs.
If this doesn't answer your question, post an example of what you are attempting.

