Sources Pipelines Documentation

Allocators  
All Classes Functions Variables
allocation_guard.hpp
1 #pragma once
2 
3 #include <boost/memory/memory_block.hpp>
4 
5 namespace boost { namespace memory {
6 
25 template <typename allocator_type>
26 class allocation_guard final
27 {
28 public:
38  allocation_guard(allocator_type& allocator, size_t size);
43 
47  allocation_guard& operator=(const allocation_guard& other) = delete;
48 
53  operator memory_block() const;
54 
55 private:
56  allocator_type& allocator_;
57  memory_block allocated_block_;
58 };
59 
60 
61 } }
62 
63 #include "allocation_guard.ipp"
~allocation_guard()
Deallocates the block.
allocation_guard & operator=(const allocation_guard &other)=delete
Not-copy assignable.
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.