OpenBarnyard
 
Loading...
Searching...
No Matches
STL::TAllocator< Type > Class Template Reference

#include <STL.h>

Public Types

using value_type = Type
 
using pointer = Type*
 
using const_pointer = const Type*
 
using void_pointer = void*
 
using const_void_pointer = const void*
 
using size_type = size_t
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

 TAllocator ()=default
 
 ~TAllocator ()=default
 
template<class U>
 TAllocator (const TAllocator< U > &other)
 
pointer allocate (size_type count)
 
pointer allocate (size_type count, const_void_pointer hint)
 
void deallocate (pointer ptr, size_type count)
 
size_type max_size () const
 
template<class U, class... Args>
void construct (U *ptr, Args &&... args)
 
template<class U>
void destroy (U *ptr)
 

Detailed Description

template<class Type>
class STL::TAllocator< Type >

Definition at line 14 of file STL.h.

Member Typedef Documentation

◆ const_pointer

template<class Type>
using STL::TAllocator< Type >::const_pointer = const Type*

Definition at line 20 of file STL.h.

◆ const_void_pointer

template<class Type>
using STL::TAllocator< Type >::const_void_pointer = const void*

Definition at line 23 of file STL.h.

◆ difference_type

template<class Type>
using STL::TAllocator< Type >::difference_type = std::ptrdiff_t

Definition at line 26 of file STL.h.

◆ pointer

template<class Type>
using STL::TAllocator< Type >::pointer = Type*

Definition at line 19 of file STL.h.

◆ size_type

template<class Type>
using STL::TAllocator< Type >::size_type = size_t

Definition at line 25 of file STL.h.

◆ value_type

template<class Type>
using STL::TAllocator< Type >::value_type = Type

Definition at line 17 of file STL.h.

◆ void_pointer

template<class Type>
using STL::TAllocator< Type >::void_pointer = void*

Definition at line 22 of file STL.h.

Constructor & Destructor Documentation

◆ TAllocator() [1/2]

template<class Type>
STL::TAllocator< Type >::TAllocator ( )
default

◆ ~TAllocator()

template<class Type>
STL::TAllocator< Type >::~TAllocator ( )
default

◆ TAllocator() [2/2]

template<class Type>
template<class U>
STL::TAllocator< Type >::TAllocator ( const TAllocator< U > & other)
inline

Definition at line 32 of file STL.h.

32{}

Member Function Documentation

◆ allocate() [1/2]

template<class Type>
pointer STL::TAllocator< Type >::allocate ( size_type count)
inline

Definition at line 34 of file STL.h.

35 {
36 return static_cast<pointer>( TMalloc( sizeof( value_type ) * count ) );
37 }
void * TMalloc(TSIZE a_uiSize, Toshi::TMemory::MemBlock *a_pMemBlock, const TCHAR *a_szFileName, TINT a_iLineNum)
Allocates memory from a specific memory block.
Definition TMemory.cpp:973
Type value_type
Definition STL.h:17
Type * pointer
Definition STL.h:19

◆ allocate() [2/2]

template<class Type>
pointer STL::TAllocator< Type >::allocate ( size_type count,
const_void_pointer hint )
inline

Definition at line 39 of file STL.h.

40 {
41 return allocate( count );
42 }
pointer allocate(size_type count)
Definition STL.h:34

◆ construct()

template<class Type>
template<class U, class... Args>
void STL::TAllocator< Type >::construct ( U * ptr,
Args &&... args )
inline

Definition at line 55 of file STL.h.

56 {
57 new ( ptr ) U( std::forward<Args>( args )... );
58 }

◆ deallocate()

template<class Type>
void STL::TAllocator< Type >::deallocate ( pointer ptr,
size_type count )
inline

Definition at line 44 of file STL.h.

45 {
46 TFree( ptr );
47 }
void TFree(void *a_pMem)
Frees previously allocated memory.
Definition TMemory.cpp:1054

◆ destroy()

template<class Type>
template<class U>
void STL::TAllocator< Type >::destroy ( U * ptr)
inline

Definition at line 61 of file STL.h.

62 {
63 ptr->~U();
64 }

◆ max_size()

template<class Type>
size_type STL::TAllocator< Type >::max_size ( ) const
inline

Definition at line 49 of file STL.h.

50 {
52 }

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