|
BDE 4.39.x Production Release
|
#include <bdlma_aligningallocator.h>
This class provides a mechanism that serves as a wrapper around another allocator, passed at construction. The mechanism guarantees that all allocations passed to the underlying allocator will be aligned by the alignment specified at construction.
Public Member Functions | |
| AligningAllocator (bsls::Types::size_type alignment, bslma::Allocator *basicAllocator=0) | |
| void * | allocate (bsls::Types::size_type size) BSLS_KEYWORD_OVERRIDE |
| void | deallocate (void *address) BSLS_KEYWORD_OVERRIDE |
Public Member Functions inherited from bslma::Allocator | |
| ~Allocator () BSLS_KEYWORD_OVERRIDE | |
| template<class TYPE > | |
| void | deleteObject (const TYPE *object) |
| template<class TYPE > | |
| void | deleteObjectRaw (const TYPE *object) |
| void | deleteObject (bsl::nullptr_t) |
| void | deleteObjectRaw (bsl::nullptr_t) |
Public Member Functions inherited from bsl::memory_resource | |
| memory_resource () BSLS_KEYWORD_DEFAULT | |
| memory_resource (const memory_resource &) BSLS_KEYWORD_DEFAULT | |
| virtual | ~memory_resource () |
| memory_resource & | operator= (const memory_resource &) BSLS_KEYWORD_DEFAULT |
| BSLA_NODISCARD void * | allocate (size_t bytes, size_t alignment=k_MAX_ALIGN) |
| void | deallocate (void *p, size_t bytes, size_t alignment=k_MAX_ALIGN) |
| bool | is_equal (const memory_resource &other) const BSLS_KEYWORD_NOEXCEPT |
Additional Inherited Members | |
Public Types inherited from bslma::Allocator | |
| typedef std::size_t | size_type |
Static Public Member Functions inherited from bslma::Allocator | |
| static void | throwBadAlloc () |
Protected Member Functions inherited from bslma::Allocator | |
| void * | do_allocate (std::size_t bytes, std::size_t alignment) BSLS_KEYWORD_OVERRIDE |
| void | do_deallocate (void *p, std::size_t bytes, std::size_t alignment) BSLS_KEYWORD_OVERRIDE |
| bool | do_is_equal (const memory_resource &other) const BSLS_KEYWORD_NOEXCEPT BSLS_KEYWORD_OVERRIDE |
|
explicit |
Create an AligningAllocator object that guarantees alignment by the specified alignment (in bytes) of memory allocated. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0 or not supplied, the currently installed default allocator is used.
alignment is a power of 2, and the alignment strategy of the alocator used to supply memory is BSLS_MAXIMUM or BSLS_NATURAL.
|
virtual |
Return a newly allocated block of memory of (at least) the specified positive size (in bytes). If size is 0, a null pointer is returned with no other effect. If this allocator cannot return the requested number of bytes, then it will throw a std::bad_alloc exception in an exception-enabled build, or else will abort the program in a non-exception build.
size and is also guaranteed to be at least the alignment passed to the constructor. Implements bslma::Allocator.
|
virtual |
Return the memory block at the specified address back to this allocator. If address is 0, this function has no effect.
address was allocated using this allocator object and has not already been deallocated. Implements bslma::Allocator.