Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions

bslalg::ContainerBase< ALLOCATOR > Class Template Reference

#include <bslalg_containerbase.h>

List of all members.

Public Types

typedef Base::AllocatorType AllocatorType
typedef bsl::allocator_traits
< AllocatorType
AllocatorTraits
typedef AllocatorTraits::size_type size_type
typedef
AllocatorTraits::difference_type 
difference_type
typedef AllocatorTraits::pointer pointer
typedef
AllocatorTraits::const_pointer 
const_pointer
typedef AllocatorTraits::value_type value_type

Public Member Functions

 ContainerBase (const ALLOCATOR &basicAllocator)
 ContainerBase (const ContainerBase &rhs)
 ~ContainerBase ()
pointer allocate (size_type n, const void *hint=0)
template<class T >
T * allocateN (T *p, size_type n)
void construct (pointer p, const value_type &val)
void deallocate (pointer p, size_type n=1)
template<class T >
void deallocateN (T *p, size_type n)
void destroy (pointer p)
bool equalAllocator (const ContainerBase &rhs) const

Detailed Description

template<class ALLOCATOR>
class bslalg::ContainerBase< ALLOCATOR >

Allocator proxy class for STL-style containers. Provides access to the allocator. Implements the entire STL allocator interface, redirecting allocation and deallocation calls to the proxied allocator. One of two possible base classes is chosen depending on whether ALLOCATOR is constructed from bslma::Allocator*.

See Component bslalg_containerbase


Member Typedef Documentation

template<class ALLOCATOR >
typedef Base::AllocatorType bslalg::ContainerBase< ALLOCATOR >::AllocatorType
template<class ALLOCATOR >
typedef bsl::allocator_traits<AllocatorType> bslalg::ContainerBase< ALLOCATOR >::AllocatorTraits
template<class ALLOCATOR >
typedef AllocatorTraits::size_type bslalg::ContainerBase< ALLOCATOR >::size_type
template<class ALLOCATOR >
typedef AllocatorTraits::difference_type bslalg::ContainerBase< ALLOCATOR >::difference_type
template<class ALLOCATOR >
typedef AllocatorTraits::pointer bslalg::ContainerBase< ALLOCATOR >::pointer
template<class ALLOCATOR >
typedef AllocatorTraits::const_pointer bslalg::ContainerBase< ALLOCATOR >::const_pointer
template<class ALLOCATOR >
typedef AllocatorTraits::value_type bslalg::ContainerBase< ALLOCATOR >::value_type

Constructor & Destructor Documentation

template<class ALLOCATOR >
bslalg::ContainerBase< ALLOCATOR >::ContainerBase ( const ALLOCATOR &  basicAllocator  ) 

Construct this object using the specified basicAllocator of the parameterized ALLOCATOR type.

template<class ALLOCATOR >
bslalg::ContainerBase< ALLOCATOR >::ContainerBase ( const ContainerBase< ALLOCATOR > &  rhs  ) 

Initialize this container base with rhs. NOTE: This is not a true copy constructor. The allocator does not get copied if the allocator is bslma-based. Using BSL allocator semantics, the bslma-style allocator must be supplied explicitly (i.e., not copied from rhs) or else it is given a default value. Non-'bslma' allocators ARE copied because that is the way the ISO standard is currently written.

template<class ALLOCATOR >
bslalg::ContainerBase< ALLOCATOR >::~ContainerBase (  ) 

Destroy this object.


Member Function Documentation

template<class ALLOCATOR >
pointer bslalg::ContainerBase< ALLOCATOR >::allocate ( size_type  n,
const void *  hint = 0 
)

Allocate enough (properly aligned) space for n objects of type T by calling allocate on the mechanism object. The hint argument is ignored by this allocator type.

template<class ALLOCATOR >
template<class T >
T* bslalg::ContainerBase< ALLOCATOR >::allocateN ( T *  p,
size_type  n 
) [inline]
Parameters:
n Allocate (but do not initialize) n objects of type T using the allocator returned by allocator. Return a pointer to the raw memory that was allocated. The p argument is used only to determine the type of object being allocated; its value (usually null) is not used.
template<class ALLOCATOR >
void bslalg::ContainerBase< ALLOCATOR >::construct ( pointer  p,
const value_type val 
)

Copy-construct a T object at the memory address specified by p. Do not directly allocate memory. The behavior is undefined if p is not properly aligned for T.

template<class ALLOCATOR >
void bslalg::ContainerBase< ALLOCATOR >::deallocate ( pointer  p,
size_type  n = 1 
)

Return memory previously allocated with allocate to the underlying mechanism object by calling deallocate on the mechanism object. The n argument is ignored by this allocator type.

template<class ALLOCATOR >
template<class T >
void bslalg::ContainerBase< ALLOCATOR >::deallocateN ( T *  p,
size_type  n 
) [inline]
Parameters:
n Return n objects of type T, starting at p to the allocator returned by allocator. Does not call destructors on the deallocated objects.
template<class ALLOCATOR >
void bslalg::ContainerBase< ALLOCATOR >::destroy ( pointer  p  ) 

Call the T destructor for the object pointed to by p. Do not directly deallocate any memory.

template<class ALLOCATOR >
bool bslalg::ContainerBase< ALLOCATOR >::equalAllocator ( const ContainerBase< ALLOCATOR > &  rhs  )  const

Returns this->allocator() == rhs.allocator().


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