Because our app has hard performance and memory constraints, our coding standards forbid the use of the default heap — ie, no malloc
, no default new
You can just declare operator new = delete
, similar to how you'd disable some constructors. Like
struct Foo {
void* operator new(std::size_t) = delete;
void* operator new[](std::size_t) = delete;
};
That'll give you compiler errors when you try to use new
with this class. See https://godbolt.org/z/RToOcf