Allocator Class Template Reference

List of all members.

Detailed Description

template<typename T>
class omni::pool::Allocator< T >

Fast allocator for STL containers.

This class uses global pool and can be used with many STL containers. Any allocation/deallocation methods use mem_get_sized() and mem_put_sized() functions.

For example:

  std::vector<double, omni::pool::Allocator<double> > a;
  std::list<int, omni::pool::Allocator<int> > b;

Public Types

Public Member Functions

Classes


Member Typedef Documentation

typedef T value_type

Value type.

typedef const T& const_reference

Constant reference type.

typedef T& reference

Reference type.

typedef const T* const_pointer

Constant pointer type.

typedef T* pointer

Pointer type.

typedef ptrdiff_t difference_type

Difference type.

typedef size_t size_type

Size type.


Constructor & Destructor Documentation

Allocator (  )  [inline]

Default constructor.

Allocator ( const Allocator< U > &   )  [inline]

Auxiliary copy-constructor.


Member Function Documentation

const_pointer address ( const_reference  x  )  const [inline]

Get address by constant reference.

Parameters:
[in] x The constant reference.
Returns:
The constant pointer.

pointer address ( reference  x  )  const [inline]

Get address by reference.

Parameters:
[in] x The reference.
Returns:
The pointer.

Allocator<T>& operator= ( const Allocator< U > &   )  [inline]

Auxiliary assignment operator.

pointer allocate ( size_type  n  )  [inline]

The memory allocation.

This method allocates memory block for n objects.

Parameters:
[in] n The number of adjacent objects.
Returns:
The memory block.

pointer allocate ( size_type  n,
const void *   
) [inline]

The memory allocation.

This method allocates memory block for n objects. Second argument (allocation hint) is not used.

Parameters:
[in] n The number of adjacent objects.
Returns:
The memory block.

char* _Charalloc ( size_type  n  )  [inline]

The memory allocation.

This method allocates memory block of n bytes. It is used by STL containers in Visual C++ 6.0!

Parameters:
[in] n The memory block size in bytes.
Returns:
The memory block.

void deallocate ( void *  p,
size_type   
) [inline]

The memory deallocation.

This method deallocates memory block p. the second argument (memory block size) is not used.

Parameters:
[in] p The memory block.

void construct ( pointer  p,
const_reference  x 
) [inline]

Object construction.

This method constructs the object at address p using placement new operator.

Parameters:
[in] p The address of object.
[in] x Construction prototype.

void destroy ( pointer  p  )  [inline]

Object destruction.

This method destroys object p.

Parameters:
[in] p The address of object.

size_type max_size (  )  const [inline]

Maximum number of objects.

This method returns the maximum number of objects, which can be allocated using this allocator.

Returns:
The maximum number of objects.


Generated on Wed Jun 6 17:27:47 2007 for OMNI by  doxygen 1.5.2