I found the following declaration on StackOverflow to replace the new
/ delete
operator. But i would like to understand this notation
How to properly replace global new & delete operators
void * operator new(decltype(sizeof(0)) n) noexcept(false)
Now let's split up: New obviusly needs to return a Pointer. And new
is used as an operator. So far so good. It is also clear to me the n
must represent the number of bytes to allocate.
The unclear part is the argument:
sizeof(0)
(on a 32bit machine) evaluates to sizeof(int) = 4
Then I got decltype(4 n)
???
What does this mean?