Loki: Loki::LokiAllocator< Type, AllocT > Class Template Reference

# Loki::LokiAllocator< Type, AllocT > Class Template Reference

`#include <Allocator.h>`

List of all members.

## Classes
struct | rebind
| Convert an allocator<Type> to an allocator <Type1>. More...
## Public Member Functions
| LokiAllocator (void) throw ()
| Default constructor does nothing.
| LokiAllocator (const LokiAllocator &) throw ()
| Copy constructor does nothing.
template<typename Type1 >
| LokiAllocator (const LokiAllocator< Type1 > &) throw ()
| Type converting allocator constructor does nothing.
| ~LokiAllocator () throw ()
| Destructor does nothing.
pointer | address (reference elem) const
| Return address of reference to mutable element.
const_pointer | address (const_reference elem) const
| Return address of reference to const element.
pointer | allocate (size_type count, const void *hint=0)
void | deallocate (pointer p, size_type size)
| Ask allocator to release memory at pointer with size bytes.
size_type | max_size (void) const throw ()
| Calculate max # of elements allocator can handle.
void | construct (pointer p, const Type &value)
| Construct an element at the pointer.
void | destroy (pointer p)
| Destruct the object at pointer.

## Detailed Description

### template<typename Type, typename AllocT = Loki::AllocatorSingleton<>>
class Loki::LokiAllocator< Type, AllocT >

Adapts Loki's Small-Object Allocator for STL container classes. This class provides all the functionality required for STL allocators, but uses Loki's Small-Object Allocator to perform actual memory operations. Implementation comes from a post in Loki forums (by Rasmus Ekman?).

## Member Function Documentation

template<typename Type, typename AllocT = Loki::AllocatorSingleton<>>

pointer Loki::LokiAllocator< Type, AllocT >::allocate | ( | size_type | count,
|  | const void * | hint = `0` |
| ) |  |  | `[inline]`

Allocate an array of count elements. Warning! The true parameter in the call to Allocate means this function can throw exceptions. This is better than not throwing, and returning a null pointer in case the caller assumes the return value is not null.

Parameters:

  | count | # of elements in array.
  | hint | Place where caller thinks allocation should occur.

Returns:
  Pointer to block of memory.

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

- Allocator.h