3 #include "allocation_guard.hpp" 6 namespace boost {
namespace memory {
8 template <
typename allocator_type>
11 allocator_(allocator),
12 allocated_block_(allocator.allocate(size))
17 template <
typename allocator_type>
20 if (allocated_block_ != null_block)
21 allocator_.deallocate(allocated_block_);
24 template <
typename allocator_type>
27 return allocated_block_;
~allocation_guard()
Deallocates the block.
allocation_guard(allocator_type &allocator, size_t size)
Allocates a block of given size in RAII style.
Provides a convenient RAII-style mechanism for owning a memory block.
Represents an allocated memory block.