# Ogre::AlignedAllocator< T, Alignment > Class Template Reference

STL compatible allocator with aligned memory allocate, used for tweak STL containers work with aligned memory. More...

`#include <OgreAlignedAllocator.h>`

List of all members.

## Public Types

typedef T | value_type
typedef value_type * | pointer
typedef const value_type * | const_pointer
typedef value_type & | reference
typedef const value_type & | const_reference
typedef std::size_t | size_type
typedef std::ptrdiff_t | difference_type

## Public Member Functions

| AlignedAllocator ()
template<typename U, unsigned A>
| AlignedAllocator (const AlignedAllocator< U, A > &)
bool | operator== (const AlignedAllocator &) const
bool | operator!= (const AlignedAllocator &) const

## Static Public Member Functions

static pointer | address (reference r)
static const_pointer | address (const_reference s)
static size_type | max_size ()
static void | construct (const pointer ptr, const value_type &t)
static void | destroy (const pointer ptr)
static pointer | allocate (const size_type n)
static pointer | allocate (const size_type n, const void *const)
static void | deallocate (const pointer ptr, const size_type)

## Private Types

typedef int | IsValidAlignment [Alignment<=128 &&((Alignment &(Alignment-1))==0)?+1:-1]

## Classes

struct | rebind

## Detailed Description

### template<typename T, unsigned Alignment = 0>
class Ogre::AlignedAllocator< T, Alignment >

STL compatible allocator with aligned memory allocate, used for tweak STL containers work with aligned memory.

Remarks:
  This class designed for work with STL containers, by use this class instead of std::allocator, the STL containers can work with aligned memory allocate seamless.

Note:
  template parameter Alignment equal to zero means use default platform dependent alignment.

Definition at line 104 of file OgreAlignedAllocator.h.

## Member Typedef Documentation

template<typename T, unsigned Alignment = 0>

typedef int Ogre::AlignedAllocator< T, Alignment >::IsValidAlignment[Alignment<=128 &&((Alignment &(Alignment-1))==0)?+1:-1]`[private]`

Definition at line 108 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

typedef T Ogre::AlignedAllocator< T, Alignment >::value_type

Definition at line 113 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

typedef value_type* Ogre::AlignedAllocator< T, Alignment >::pointer

Definition at line 115 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

typedef const value_type* Ogre::AlignedAllocator< T, Alignment >::const_pointer

Definition at line 116 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

typedef value_type& Ogre::AlignedAllocator< T, Alignment >::reference

Definition at line 117 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

typedef const value_type& Ogre::AlignedAllocator< T, Alignment >::const_reference

Definition at line 118 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

typedef std::size_t Ogre::AlignedAllocator< T, Alignment >::size_type

Definition at line 119 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

typedef std::ptrdiff_t Ogre::AlignedAllocator< T, Alignment >::difference_type

Definition at line 120 of file OgreAlignedAllocator.h.

## Constructor & Destructor Documentation

template<typename T, unsigned Alignment = 0>

Ogre::AlignedAllocator< T, Alignment >::AlignedAllocator | ( |  | ) |

Definition at line 129 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>
template<typename U, unsigned A>

Ogre::AlignedAllocator< T, Alignment >::AlignedAllocator | ( | const AlignedAllocator< U, A > & |  | ) |

Definition at line 137 of file OgreAlignedAllocator.h.

## Member Function Documentation

template<typename T, unsigned Alignment = 0>

static pointer Ogre::AlignedAllocator< T, Alignment >::address | ( | reference | r | ) | `[static]`

Definition at line 143 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

static const_pointer Ogre::AlignedAllocator< T, Alignment >::address | ( | const_reference | s | ) | `[static]`

Definition at line 145 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

static size_type Ogre::AlignedAllocator< T, Alignment >::max_size | ( |  | ) | `[static]`

Definition at line 147 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

static void Ogre::AlignedAllocator< T, Alignment >::construct | ( | const pointer | ptr,
|  | const value_type & | t |
| ) |  |  | `[static]`

Definition at line 149 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

static void Ogre::AlignedAllocator< T, Alignment >::destroy | ( | const pointer | ptr | ) | `[static]`

Definition at line 151 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

bool Ogre::AlignedAllocator< T, Alignment >::operator== | ( | const AlignedAllocator< T, Alignment > & |  | ) | const

Definition at line 157 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

bool Ogre::AlignedAllocator< T, Alignment >::operator!= | ( | const AlignedAllocator< T, Alignment > & |  | ) | const

Definition at line 159 of file OgreAlignedAllocator.h.

template<typename T, unsigned Alignment = 0>

static pointer Ogre::AlignedAllocator< T, Alignment >::allocate | ( | const size_type | n | ) | `[static]`

Definition at line 162 of file OgreAlignedAllocator.h.

References Ogre::AlignedMemory::allocate().

Referenced by Ogre::AlignedAllocator< T, Alignment >::allocate().

template<typename T, unsigned Alignment = 0>

static pointer Ogre::AlignedAllocator< T, Alignment >::allocate | ( | const size_type | n,
|  | const void * | const |
| ) |  |  | `[static]`

Definition at line 170 of file OgreAlignedAllocator.h.

References Ogre::AlignedAllocator< T, Alignment >::allocate().

template<typename T, unsigned Alignment = 0>

static void Ogre::AlignedAllocator< T, Alignment >::deallocate | ( | const pointer | ptr,
|  | const | size_type |
| ) |  |  | `[static]`

Definition at line 174 of file OgreAlignedAllocator.h.

References Ogre::AlignedMemory::deallocate().

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

- OgreAlignedAllocator.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:25:13 2008