# Ogre::STLAllocator< T, AllocPolicy > Class Template Reference

Wrapper class for operating as an STL container allocator. More...

`#include <OgreMemorySTLAllocator.h>`

List of all members.

## Public Types

typedef T | value_type
| define our types, as per ISO C++
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

| STLAllocator ()
| ctor
virtual | ~STLAllocator ()
| dtor
| STLAllocator (STLAllocator const &rhs)
| copy ctor - done component wise
template<typename U>
| STLAllocator (STLAllocator< U, AllocPolicy > const &)
| cast
template<typename U, typename P>
| STLAllocator (STLAllocator< U, P > const &rhs)
| cast
pointer | allocate (size_type count, typename std::allocator< void >::const_pointer ptr=0)
| memory allocation (elements, used by STL)
void | deallocate (pointer ptr, size_type count)
| memory deallocation (elements, used by STL)
pointer | address (reference x) const
const_pointer | address (const_reference x) const
size_type | max_size () const throw ()
void | construct (pointer p, const T &val)
void | destroy (pointer p)

## Classes

struct | rebind
| the standard rebind mechanism More...

## Detailed Description

### template<typename T, typename AllocPolicy>
class Ogre::STLAllocator< T, AllocPolicy >

Wrapper class for operating as an STL container allocator.

This class acts as the host for a configured allocation policy.

It takes the following template parameters:-

- T : the type we will be allocating (see rebind later)
- AllocPolicy : a memory allocator policy

See StdAllocPolicy for an example of implementing a Policy. The reason for implementing the allocation in a policy is that it makes implementing a custom allocator easier - you just have to provide an alternative policy with just allocate/deallocate implementations; this class does all the housekeeping associated with keeping the STL happy.

Definition at line 60 of file OgreMemorySTLAllocator.h.

## Member Typedef Documentation

template<typename T, typename AllocPolicy>

typedef T Ogre::STLAllocator< T, AllocPolicy >::value_type

define our types, as per ISO C++

Definition at line 64 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

typedef value_type* Ogre::STLAllocator< T, AllocPolicy >::pointer

Definition at line 65 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

typedef const value_type* Ogre::STLAllocator< T, AllocPolicy >::const_pointer

Definition at line 66 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

typedef value_type& Ogre::STLAllocator< T, AllocPolicy >::reference

Definition at line 67 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

typedef const value_type& Ogre::STLAllocator< T, AllocPolicy >::const_reference

Definition at line 68 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

typedef std::size_t Ogre::STLAllocator< T, AllocPolicy >::size_type

Definition at line 69 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

typedef std::ptrdiff_t Ogre::STLAllocator< T, AllocPolicy >::difference_type

Definition at line 70 of file OgreMemorySTLAllocator.h.

## Constructor & Destructor Documentation

template<typename T, typename AllocPolicy>

Ogre::STLAllocator< T, AllocPolicy >::STLAllocator | ( |  | ) | `[explicit]`

ctor

Definition at line 81 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

virtual Ogre::STLAllocator< T, AllocPolicy >::~STLAllocator | ( |  | ) | `[virtual]`

dtor

Definition at line 85 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

Ogre::STLAllocator< T, AllocPolicy >::STLAllocator | ( | STLAllocator< T, AllocPolicy > const & | rhs | ) |

copy ctor - done component wise

Definition at line 89 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>
template<typename U>

Ogre::STLAllocator< T, AllocPolicy >::STLAllocator | ( | STLAllocator< U, AllocPolicy > const & |  | ) |

cast

Definition at line 94 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>
template<typename U, typename P>

Ogre::STLAllocator< T, AllocPolicy >::STLAllocator | ( | STLAllocator< U, P > const & | rhs | ) |

cast

Definition at line 99 of file OgreMemorySTLAllocator.h.

## Member Function Documentation

template<typename T, typename AllocPolicy>

pointer Ogre::STLAllocator< T, AllocPolicy >::allocate | ( | size_type | count,
|  | typename std::allocator< void >::const_pointer | ptr = `0` |
| ) |  |  |

memory allocation (elements, used by STL)

Definition at line 103 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

void Ogre::STLAllocator< T, AllocPolicy >::deallocate | ( | pointer | ptr,
|  | size_type | count |
| ) |  |  |

memory deallocation (elements, used by STL)

Definition at line 113 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

pointer Ogre::STLAllocator< T, AllocPolicy >::address | ( | reference | x | ) | const

Definition at line 120 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

const_pointer Ogre::STLAllocator< T, AllocPolicy >::address | ( | const_reference | x | ) | const

Definition at line 125 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

size_type Ogre::STLAllocator< T, AllocPolicy >::max_size | ( |  | ) | const throw ()

Definition at line 130 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

void Ogre::STLAllocator< T, AllocPolicy >::construct | ( | pointer | p,
|  | const T & | val |
| ) |  |  |

Definition at line 136 of file OgreMemorySTLAllocator.h.

template<typename T, typename AllocPolicy>

void Ogre::STLAllocator< T, AllocPolicy >::destroy | ( | pointer | p | ) |

Definition at line 142 of file OgreMemorySTLAllocator.h.

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

- OgreMemorySTLAllocator.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 26 11:34:03 2009