PooledAllocator< T > Class Template Reference

A STL-compliant pooled memory allocator. Much more efficient for lists of small data structures.

Data Structures

Public Types

Public Member Functions

Data Fields

template<typename T>
class PooledAllocator< T >


Member Typedef Documentation

template<typename T>
typedef size_t PooledAllocator< T >::size_type
template<typename T>
typedef ptrdiff_t PooledAllocator< T >::difference_type
template<typename T>
typedef T PooledAllocator< T >::value_type
template<typename T>
typedef T* PooledAllocator< T >::pointer
template<typename T>
typedef T const* PooledAllocator< T >::const_pointer
template<typename T>
typedef T& PooledAllocator< T >::reference
template<typename T>
typedef T const& PooledAllocator< T >::const_reference

Constructor & Destructor Documentation

template<typename T>
PooledAllocator< T >::PooledAllocator ( Pool pool = 0  )  [inline]

This is non-explicit for ease of use.

References Pool::GetElemSize(), and PooledAllocator< T >::m_pool.

template<typename T>
template<typename U >
PooledAllocator< T >::PooledAllocator ( PooledAllocator< U > const &  arg  )  [inline]

If the argument has no pool, then this allocator will allocate off the heap.

References Pool::GetElemSize(), and PooledAllocator< T >::m_pool.


Member Function Documentation

template<typename T>
size_type PooledAllocator< T >::max_size (  )  const [inline]
template<typename T>
pointer PooledAllocator< T >::allocate ( size_type  count,
std::allocator< void >::const_pointer  = 0 
) const [inline]

This function may raise an appropriate exception. The result is a random access iterator.

References Pool::Allocate(), and PooledAllocator< T >::m_pool.

template<typename T>
void PooledAllocator< T >::deallocate ( pointer  block,
size_type  count 
) const throw () [inline]

All count objects in the area pointed by block must be destroyed prior to this call. count must match the value passed to allocate to obtain this memory. Does not throw exceptions. block must not be null.

References Pool::Deallocate(), and PooledAllocator< T >::m_pool.

template<typename T>
void PooledAllocator< T >::construct ( pointer  element,
T const &  arg 
) [inline]

Effect: new( element ) T( arg )

template<typename T>
void PooledAllocator< T >::destroy ( pointer  element  )  [inline]

Effect: element->~T()

template<typename T>
pointer PooledAllocator< T >::address ( reference  element  )  const [inline]
template<typename T>
const_pointer PooledAllocator< T >::address ( const_reference  element  )  const [inline]

Field Documentation

template<typename T>
Pool* PooledAllocator< T >::m_pool

Generated on 4 Nov 2015 for CURE by  doxygen 1.6.1