![]() |
Allocators
|
Provides a convenient RAII-style mechanism for owning a memory block. More...
#include <allocation_guard.hpp>
Public Member Functions | |
allocation_guard (allocator_type &allocator, size_t size) | |
Allocates a block of given size in RAII style. More... | |
~allocation_guard () | |
Deallocates the block. | |
allocation_guard & | operator= (const allocation_guard &other)=delete |
Not-copy assignable. | |
operator memory_block () const | |
Information about allocated underlying memory block. More... | |
Provides a convenient RAII-style mechanism for owning a memory block.
RAII-style binds lifespan of the allocated block with the guard object. Usage example:
Definition at line 26 of file allocation_guard.hpp.
boost::memory::allocation_guard< allocator_type >::allocation_guard | ( | allocator_type & | allocator, |
size_t | size | ||
) |
Allocates a block of given size in RAII style.
Using allocator instance, this constructor allocates memory block of the desired size and binds it's lifecycle with lifecycle of this guard.
allocator | The allocator instance to use. |
size | Desired amount of memory to allocate. |
Definition at line 9 of file allocation_guard.ipp.
boost::memory::allocation_guard< allocator_type >::operator memory_block | ( | ) | const |
Information about allocated underlying memory block.
Definition at line 25 of file allocation_guard.ipp.