Returns a pointer to a memory_resource
that doesn't perform any allocation.
Returns a pointer p
to a static storage duration object of a type derived from std::pmr::memory_resource, with the following properties:
allocate()
function always throws std::bad_alloc;deallocate()
function has no effect;memory_resource
r
, p->is_equal(r) returns &r == p.The same value is returned every time this function is called.
[edit] ExampleThe program demos the main usage of null_memory_resource
: ensure that a memory pool which requires memory allocated on the stack will NOT allocate memory on the heap if it needs more memory.
Possible output:
size: 50... size: 100... size: 150... std::bad_alloc size: 183
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4