Skip to content

Instantly share code, notes, and snippets.

@mpenick
Created May 3, 2016 21:14
Show Gist options
  • Select an option

  • Save mpenick/9de7888f2fc6c62b1808ed6813591b71 to your computer and use it in GitHub Desktop.

Select an option

Save mpenick/9de7888f2fc6c62b1808ed6813591b71 to your computer and use it in GitHub Desktop.
namespace cass {
struct Memory {
static void* operator new(std::size_t size) {
printf("in-class new\n");
return malloc(size);
}
static void* operator new[](std::size_t size) {
printf("in-class new[]\n");
return malloc(size);
}
static void operator delete(void* ptr) {
printf("in-class delete\n");
return free(ptr);
}
static void operator delete[](void* ptr) {
printf("in-class delete[]\n");
return free(ptr);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment