arsa  2.7
Public Member Functions | Protected Member Functions | List of all members
irr::core::irrAllocator< T > Class Template Reference

Very simple allocator implementation, containers using it can be used across dll boundaries. More...

#include <irrAllocator.h>

Public Member Functions

virtual ~irrAllocator ()
 Destructor. More...
 
T * allocate (size_t cnt)
 Allocate memory for an array of objects. More...
 
void deallocate (T *ptr)
 Deallocate memory for an array of objects. More...
 
void construct (T *ptr, const T &e)
 Construct an element. More...
 
void destruct (T *ptr)
 Destruct an element. More...
 

Protected Member Functions

virtual voidinternal_new (size_t cnt)
 
virtual void internal_delete (void *ptr)
 

Detailed Description

template<typename T>
class irr::core::irrAllocator< T >

Very simple allocator implementation, containers using it can be used across dll boundaries.

Definition at line 25 of file irrAllocator.h.

Constructor & Destructor Documentation

◆ ~irrAllocator()

template<typename T>
virtual irr::core::irrAllocator< T >::~irrAllocator ( )
inlinevirtual

Destructor.

Definition at line 30 of file irrAllocator.h.

30 {}

Member Function Documentation

◆ allocate()

template<typename T>
T* irr::core::irrAllocator< T >::allocate ( size_t  cnt)
inline

Allocate memory for an array of objects.

Definition at line 33 of file irrAllocator.h.

34  {
35  return (T*)internal_new(cnt* sizeof(T));
36  }
virtual void * internal_new(size_t cnt)
Definition: irrAllocator.h:58

◆ construct()

template<typename T>
void irr::core::irrAllocator< T >::construct ( T *  ptr,
const T &  e 
)
inline

Construct an element.

Definition at line 45 of file irrAllocator.h.

46  {
47  new ((void*)ptr) T(e);
48  }

◆ deallocate()

template<typename T>
void irr::core::irrAllocator< T >::deallocate ( T *  ptr)
inline

Deallocate memory for an array of objects.

Definition at line 39 of file irrAllocator.h.

40  {
41  internal_delete(ptr);
42  }
virtual void internal_delete(void *ptr)
Definition: irrAllocator.h:63

◆ destruct()

template<typename T>
void irr::core::irrAllocator< T >::destruct ( T *  ptr)
inline

Destruct an element.

Definition at line 51 of file irrAllocator.h.

52  {
53  ptr->~T();
54  }

◆ internal_delete()

template<typename T>
virtual void irr::core::irrAllocator< T >::internal_delete ( void ptr)
inlineprotectedvirtual

Definition at line 63 of file irrAllocator.h.

64  {
65  operator delete(ptr);
66  }

◆ internal_new()

template<typename T>
virtual void* irr::core::irrAllocator< T >::internal_new ( size_t  cnt)
inlineprotectedvirtual

Definition at line 58 of file irrAllocator.h.

59  {
60  return operator new(cnt);
61  }

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