Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
C++: How do I overload the "new" operator for placement new?
Consider the scenario:
T* t = new T();
X* x = new (t) X();
How would I do an overload of class T to allow this?
1 Answer
- ?Lv 78 years agoFavorite Answer
class T has no influence on how the statement X* x = new (t) X(); compiles. It will look for a suitable operator new (e.g. operator new(size_t, T*) or operator new(size_t, void*)) within the class scope of X, and then if none is provided there, in global scope, but it won't look inside T.