Pyrogenesis  trunk
Classes | Public Types | Public Member Functions | List of all members
AlignedAllocator< T > Class Template Reference

stateless STL allocator that aligns elements to the L1 cache line size. More...

#include <aligned_allocator.h>

Classes

struct  rebind
 

Public Types

typedef T value_type
 
typedef Tpointer
 
typedef const Tconst_pointer
 
typedef Treference
 
typedef const Tconst_reference
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 

Public Member Functions

pointer address (reference value) const
 
const_pointer address (const_reference value) const
 
NOTHROW_DEFINE AlignedAllocator ()
 
NOTHROW_DEFINE AlignedAllocator (const AlignedAllocator &)
 
template<class U >
NOTHROW_DEFINE AlignedAllocator (const AlignedAllocator< U > &)
 
NOTHROW_DEFINE ~AlignedAllocator ()
 
NOTHROW_DEFINE size_type max_size () const
 
pointer allocate (size_type numElements)
 
void deallocate (pointer p, size_type num)
 
void construct (pointer p, const T &value)
 
void destroy (pointer p)
 

Detailed Description

template<class T>
class AlignedAllocator< T >

stateless STL allocator that aligns elements to the L1 cache line size.

note: the alignment is hard-coded to avoid any allocator state. this avoids portability problems, which is important since allocators are rather poorly specified.

references: http://www.tantalon.com/pete/customallocators.ppt http://www.flipcode.com/archives/Aligned_Block_Allocation.shtml http://www.josuttis.com/cppcode/allocator.html

derived from code that bears the following copyright notice: (C) Copyright Nicolai M. Josuttis 1999. Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

Member Typedef Documentation

template<class T >
typedef const T* AlignedAllocator< T >::const_pointer
template<class T >
typedef const T& AlignedAllocator< T >::const_reference
template<class T >
typedef std::ptrdiff_t AlignedAllocator< T >::difference_type
template<class T >
typedef T* AlignedAllocator< T >::pointer
template<class T >
typedef T& AlignedAllocator< T >::reference
template<class T >
typedef std::size_t AlignedAllocator< T >::size_type
template<class T >
typedef T AlignedAllocator< T >::value_type

Constructor & Destructor Documentation

template<class T >
NOTHROW_DEFINE AlignedAllocator< T >::AlignedAllocator ( )
inline
template<class T >
NOTHROW_DEFINE AlignedAllocator< T >::AlignedAllocator ( const AlignedAllocator< T > &  )
inline
template<class T >
template<class U >
NOTHROW_DEFINE AlignedAllocator< T >::AlignedAllocator ( const AlignedAllocator< U > &  )
inline
template<class T >
NOTHROW_DEFINE AlignedAllocator< T >::~AlignedAllocator ( )
inline

Member Function Documentation

template<class T >
pointer AlignedAllocator< T >::address ( reference  value) const
inline
template<class T >
const_pointer AlignedAllocator< T >::address ( const_reference  value) const
inline
template<class T >
pointer AlignedAllocator< T >::allocate ( size_type  numElements)
inline
template<class T >
void AlignedAllocator< T >::construct ( pointer  p,
const T value 
)
inline
template<class T >
void AlignedAllocator< T >::deallocate ( pointer  p,
size_type  num 
)
inline
template<class T >
void AlignedAllocator< T >::destroy ( pointer  p)
inline
template<class T >
NOTHROW_DEFINE size_type AlignedAllocator< T >::max_size ( ) const
inline

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