Placement new, return by value and safely dispose temporary copies
问题 Due to complicated circumstances (explained in earlier question Constructing an object to return by value elsewhere) I want to return an object by value from function X, but create it in another function Y indirectly called by X. Between them there is 3rd party code in the call stack that won't co-operate in passing the object around. X can only pass pointers to Y and receive a pointer back. I've come up with a solution using placement new but mainly worry whether it's portable, doesn't