Hi,
I am having a problem overriding the new and delete operators. I have overwritten the new operator with the following:
and the delete with the following:
However I am getting an error message saying that no matching operator delete is found to match the new above.
Why does my program not recognise that the delete I have used is to match the new? Do I have to add anything to it to make it explicit?
Thanks,
Dan
I am having a problem overriding the new and delete operators. I have overwritten the new operator with the following:
Code:
void * operator new(size_t size, char const* file, int line)
{
void* v = malloc(size + sizeof(size_t));
return v;
}
and the delete with the following:
Code:
void operator delete(void * del, char const* file, int line)
{
free(del);
}
However I am getting an error message saying that no matching operator delete is found to match the new above.
Why does my program not recognise that the delete I have used is to match the new? Do I have to add anything to it to make it explicit?
Thanks,
Dan