BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlma::AlignedAllocator Class Referenceabstract

#include <bdlma_alignedallocator.h>

Inheritance diagram for bdlma::AlignedAllocator:
bslma::Allocator bsl::memory_resource

Public Member Functions

virtual void * allocateAligned (bsls::Types::size_type size, bsls::Types::size_type alignment)=0
 
- Public Member Functions inherited from bslma::Allocator
 ~Allocator () BSLS_KEYWORD_OVERRIDE
 
virtual void * allocate (size_type size)=0
 
virtual void deallocate (void *address)=0
 
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
 Create this object. Has no effect other than to begin its lifetime.
 
 memory_resource (const memory_resource &) BSLS_KEYWORD_DEFAULT
 
virtual ~memory_resource ()
 Destroy this object. Has no effect other than to end its lifetime.
 
memory_resourceoperator= (const memory_resource &) BSLS_KEYWORD_DEFAULT
 Return a modifiable reference to this object.
 
BSLS_ANNOTATION_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
 

Detailed Description

This protocol provides a pure abstract interface and contract for clients and suppliers of raw aligned memory. If the requested memory cannot be returned, the contract requires that an std::bad_alloc exception be thrown.

See bdlma_alignedallocator

Member Function Documentation

◆ allocateAligned()

virtual void * bdlma::AlignedAllocator::allocateAligned ( bsls::Types::size_type  size,
bsls::Types::size_type  alignment 
)
pure virtual

Return the address of a newly allocated block of memory of at least the specified positive size (in bytes), sufficiently aligned such that the returned address satisfies, for the specified alignment, 0 == (address & (alignment - 1)). If size is 0, a null pointer is returned with no other effect. If the requested number of appropriately aligned bytes cannot be returned, then a bsl::bad_alloc exception is thrown, or in a non-exception build the program is terminated. The behavior is undefined unless alignment is both a multiple of sizeof(void *) and an integral non-negative power of two.


The documentation for this class was generated from the following file: