Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.

Definition at line 55 of file aligned_allocator.h.

Member Typedef Documentation

template<class T >
typedef const T* AlignedAllocator< T >::const_pointer

Definition at line 61 of file aligned_allocator.h.

template<class T >
typedef const T& AlignedAllocator< T >::const_reference

Definition at line 63 of file aligned_allocator.h.

template<class T >
typedef std::ptrdiff_t AlignedAllocator< T >::difference_type

Definition at line 65 of file aligned_allocator.h.

template<class T >
typedef T* AlignedAllocator< T >::pointer

Definition at line 60 of file aligned_allocator.h.

template<class T >
typedef T& AlignedAllocator< T >::reference

Definition at line 62 of file aligned_allocator.h.

template<class T >
typedef std::size_t AlignedAllocator< T >::size_type

Definition at line 64 of file aligned_allocator.h.

template<class T >
typedef T AlignedAllocator< T >::value_type

Definition at line 59 of file aligned_allocator.h.

Constructor & Destructor Documentation

template<class T >
NOTHROW_DEFINE AlignedAllocator< T >::AlignedAllocator ( )
inline

Definition at line 84 of file aligned_allocator.h.

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

Definition at line 88 of file aligned_allocator.h.

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

Definition at line 93 of file aligned_allocator.h.

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

Definition at line 97 of file aligned_allocator.h.

Member Function Documentation

template<class T >
pointer AlignedAllocator< T >::address ( reference  value) const
inline

Definition at line 74 of file aligned_allocator.h.

template<class T >
const_pointer AlignedAllocator< T >::address ( const_reference  value) const
inline

Definition at line 79 of file aligned_allocator.h.

template<class T >
pointer AlignedAllocator< T >::allocate ( size_type  numElements)
inline

Definition at line 108 of file aligned_allocator.h.

template<class T >
void AlignedAllocator< T >::construct ( pointer  p,
const T value 
)
inline

Definition at line 123 of file aligned_allocator.h.

template<class T >
void AlignedAllocator< T >::deallocate ( pointer  p,
size_type  num 
)
inline

Definition at line 118 of file aligned_allocator.h.

template<class T >
void AlignedAllocator< T >::destroy ( pointer  p)
inline

Definition at line 128 of file aligned_allocator.h.

template<class T >
NOTHROW_DEFINE size_type AlignedAllocator< T >::max_size ( ) const
inline

Definition at line 101 of file aligned_allocator.h.


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