6 Basic concepts [basic]

6.7 Storage duration [basic.stc]

6.7.4 Dynamic storage duration [basic.stc.dynamic]

6.7.4.2 Deallocation functions [basic.stc.dynamic.deallocation]

Deallocation functions shall be class member functions or global functions; a program is ill-formed if deallocation functions are declared in a namespace scope other than global scope or declared static in global scope.
Each deallocation function shall return void and its first parameter shall be void*.
A deallocation function may have more than one parameter.
A usual deallocation function is a deallocation function that has:
  • exactly one parameter; or
  • exactly two parameters, the type of the second being either std​::​align_­val_­t or std​::​size_­t39; or
  • exactly three parameters, the type of the second being std​::​size_­t and the type of the third being std​::​align_­val_­t.
A deallocation function may be an instance of a function template.
Neither the first parameter nor the return type shall depend on a template parameter.
[Note
:
That is, a deallocation function template shall have a first parameter of type void* and a return type of void (as specified above).
end note
]
A deallocation function template shall have two or more function parameters.
A template instance is never a usual deallocation function, regardless of its signature.
If a deallocation function terminates by throwing an exception, the behavior is undefined.
The value of the first argument supplied to a deallocation function may be a null pointer value; if so, and if the deallocation function is one supplied in the standard library, the call has no effect.
If the argument given to a deallocation function in the standard library is a pointer that is not the null pointer value, the deallocation function shall deallocate the storage referenced by the pointer, ending the duration of the region of storage.
The global operator delete(void*, std​::​size_­t) precludes use of an allocation function void operator new(std​::​size_­t, std​::​size_­t) as a placement allocation function ([diff.cpp11.basic]).