Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions | Static Public Member Functions

bslma::AllocatorAdaptor< STL_ALLOC > Class Template Reference

#include <bslma_allocatoradaptor.h>

Inheritance diagram for bslma::AllocatorAdaptor< STL_ALLOC >:
bslma::AllocatorAdaptor_Imp< STL_ALLOC::template rebind< char >::other > bslma::Allocator

List of all members.

Public Types

typedef AllocatorAdaptor_Imp Type
typedef STL_ALLOC StlAllocatorType
typedef bsls::Types::size_type size_type

Public Member Functions

 AllocatorAdaptor ()
 AllocatorAdaptor (const STL_ALLOC &stla)
 AllocatorAdaptor (const AllocatorAdaptor &)
 ~AllocatorAdaptor ()
virtual void * allocate (size_type size)
virtual void deallocate (void *address)
STL_ALLOC adaptedAllocator () const
template<class TYPE >
void deleteObject (const TYPE *object)
void deleteObject (bsl::nullptr_t)
template<class TYPE >
void deleteObjectRaw (const TYPE *object)
void deleteObjectRaw (bsl::nullptr_t)

Static Public Member Functions

static void throwBadAlloc ()

Detailed Description

template<class STL_ALLOC>
class bslma::AllocatorAdaptor< STL_ALLOC >

Polymorphic wrapper around an object of the specified STL_ALLOC STL-style allocator template parameter. A pointer to an object of this class can thus be used with any component that uses BDE-style memory allocation. Note that AllocatorAdaptor<A>Type is the same type regardless of whether or not the compiler supports alias templates. It should be used, therefore, whenever the exact type of the adaptor is important.

See Component bslma_allocatoradaptor


Member Typedef Documentation

typedef AllocatorAdaptor_Imp bslma::AllocatorAdaptor_Imp< STL_ALLOC >::Type [inherited]
typedef STL_ALLOC bslma::AllocatorAdaptor_Imp< STL_ALLOC >::StlAllocatorType [inherited]

Constructor & Destructor Documentation

template<class STL_ALLOC>
bslma::AllocatorAdaptor< STL_ALLOC >::AllocatorAdaptor ( const AllocatorAdaptor< STL_ALLOC > &   ) 
template<class STL_ALLOC>
bslma::AllocatorAdaptor< STL_ALLOC >::~AllocatorAdaptor (  ) 

Member Function Documentation

virtual void* bslma::AllocatorAdaptor_Imp< STL_ALLOC >::allocate ( size_type  size  )  [virtual, inherited]

Return a maximally-aligned block of memory no smaller than size bytes allocated from the STL-style allocator that was supplied to this object's constructor. Any exceptions thrown by the underlying STL-style allocator are propagated out from this member.

Implements bslma::Allocator.

virtual void bslma::AllocatorAdaptor_Imp< STL_ALLOC >::deallocate ( void *  address  )  [virtual, inherited]

Return the memory block at the specified address back to the STL-allocator. If address is null, this funciton has no effect. The behavior is undefined unless address was allocated using this allocator object and has not already been deallocated.

Implements bslma::Allocator.

STL_ALLOC bslma::AllocatorAdaptor_Imp< STL_ALLOC >::adaptedAllocator (  )  const [inherited]

Return a copy of the STL allocator stored within this object.

static void bslma::Allocator::throwBadAlloc (  )  [static, inherited]

DEPRECATED: Use bsls::BslExceptionUtil::throwBadAlloc instead.

Throw std::bad_alloc if exceptions are enabled or abort the program otherwise. Derived classes and helper functions will typically call this function when they are unable to satisfy an allocation request. This function never returns.

template<class TYPE >
void bslma::Allocator::deleteObject ( const TYPE *  object  )  [inherited]

Destroy the specified object based on its dynamic type and then use this allocator to deallocate its memory footprint. Do nothing if object is a null pointer. The behavior is undefined unless object, when cast appropriately to void *, was allocated using this allocator and has not already been deallocated. Note that dynamic_cast<void *>(object) is applied if TYPE is polymorphic, and static_cast<void *>(object) is applied otherwise.

void bslma::Allocator::deleteObject ( bsl::nullptr_t   )  [inherited]

This function has no effect. Note that it exists to support calling deleteObject will a null pointer literal, that would otherwise not deduce to a pointer type for the method above. As calls to deleteObject with (typed) null pointer values have well-defined behavior, it should also support calls with a null pointer literal.

template<class TYPE >
void bslma::Allocator::deleteObjectRaw ( const TYPE *  object  )  [inherited]

Destroy the specified object and then use this allocator to deallocate its memory footprint. Do nothing if object is a null pointer. The behavior is undefined unless object was allocated using this allocator, is not a secondary base class pointer -- i.e., the address is (numerically) the same as when it was originally dispensed by this allocator, and has not already been deallocated.

void bslma::Allocator::deleteObjectRaw ( bsl::nullptr_t   )  [inherited]

This function has no effect. Note that it exists to support calling deleteObjectRaw will a null pointer literal, that would otherwise not deduce to a pointer type for the method above. As calls to deleteObjectRaw with (typed) null pointer values have well-defined behavior, it should also support calls with a null pointer literal.


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