October 2004
Intermediate to advanced
240 pages
6h 22m
English
new, provide all of the standard forms (plain, in-place, and nothrow)Don’t hide good news: If a class defines any overload of operator new, it should provide overloads of all three of plain, in-place, and non-throwing operator new. If you don’t, they’ll be hidden and unavailable to users of your class.
You rarely need to provide a custom new or delete, but if you need them you usually don’t want to hide the built-in signatures.
In C++, after you define a name in a scope (e.g., in a class scope), it will hide the same name in all enclosing scopes (e.g., in base classes or enclosing namespaces), and overloading never happens across scopes. And when said name is operator new, you need ...