Created
September 10, 2022 19:25
-
-
Save azat/027f0e949ea836fc2e6269113ceb8752 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include <memory> | |
struct NewDeleteOperators | |
{ | |
NewDeleteOperators() = default; | |
static void* operator new(size_t size) | |
{ | |
return ::malloc(size); | |
} | |
static void operator delete(void *p) noexcept | |
{ | |
::free(p); | |
} | |
}; | |
void testNewDeleteOperators() { | |
std::unique_ptr<NewDeleteOperators> op; | |
op.reset(new NewDeleteOperators); | |
} |
Author
azat
commented
Sep 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment