...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <new> void custom_new_handler() noexcept(false) { extern std::size_t reclaim_resources(); if (0 == reclaim_resources()) { throw std::bad_alloc(); } } int main() { std::set_new_handler(custom_new_handler); // ... } |
...
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <new> void custom_new_handler() noexcept(false) { extern std::size_t reclaim_resources(); if (0 == reclaim_resources()) { throw std::bad_alloc(); } } int main() { std::set_new_handler(custom_new_handler); // ... } |
...