Custom global new operator
| 24 | |
| 25 | // Custom global new operator |
| 26 | void* operator new(std::size_t size) { |
| 27 | void* ptr = malloc(size); |
| 28 | if (reinterpret_cast<int>(ptr) < 0) { |
| 29 | throw std::bad_alloc(); |
| 30 | } |
| 31 | return ptr; |
| 32 | } |
| 33 | |
| 34 | // Custom global new[] operator |
| 35 | void* operator new[](std::size_t size) { |