placement
delete Feature Fully Supported
The placement delete feature is fully implemented in this version.
If, during object initialization, as part of a placement new call (for example, during constructor invocation
on a class object instance), an exception is thrown, then a matching placement delete call is made, with the same arguments as placement new.
Example:
class A { public: void *operator new(size_t); void operator delete(void *); void *operator new(size_t, A*); void operator delete(void*, A*); // ... };
|
Given the following placement new expression:
If the default constructor for class A exits by throwing an exception, the implementation
looks for an operator delete() in the scope of class A.
For an operator delete() to be considered, it must have parameters with
types that match those of the operator new() called. Because the first parameter of an operator new() is always of type size_t and the first parameter of an operator delete() is always of type void*, the first parameter of each function is not considered
for this comparison.
The implementation looks in class A for an operator delete() of the following form:
void operator delete(void*, A*); |
If operator delete() is found in class A, it is called to deallocate the storage. If operator delete() is not found, then it is not called.