So I was wondering, if one were to use malloc or some malloc-styled allocation (i.e. not using) new, and then using placement new on that memory, would calling delete on that memory then be defined according to the standard?
This may seem silly. Why would anyone want to do this? But sometimes there are libraries written in C that you just have to use.
Example:
Code:auto* p = malloc(sizeof(std::vector<int>)); auto* v = new (v) std::vector<int>(); // Use v delete v; v = p = nullptr;