2#include "Toshi/Memory/TMemory.h"
6#include <unordered_map>
51 return std::numeric_limits<size_type>::max();
54 template <
class U,
class... Args>
57 new ( ptr ) U( std::forward<Args>( args )... );
75using Ref = std::shared_ptr<T>;
78using Scope = std::unique_ptr<T, MemoryDeleter<T>>;
81using Vector = std::vector<T, Toshi::STL::TAllocator<T>>;
83template <
typename Key,
typename T>
84using Map = std::map<Key, T, std::less<Key>, Toshi::STL::TAllocator<std::pair<const Key, T>>>;
86template <
typename Key,
typename T>
87using UnorderedMap = std::unordered_map<Key, T, std::hash<Key>, std::equal_to<Key>, Toshi::STL::TAllocator<std::pair<const Key, T>>>;
89template <
typename T,
typename... Args>
92 return std::allocate_shared<T>( Toshi::STL::TAllocator<T>(), std::forward<Args>( args )... );
95template <
typename T,
typename... Args>
98 return Scope<T>(
new T( std::forward<Args>( args )... ) );
101template <
typename T,
typename Result,
typename... Args>
104 return Scope<Result>(
new T( std::forward<Args>( args )... ) );
void * TMalloc(TSIZE a_uiSize, Toshi::TMemory::MemBlock *a_pMemBlock, const TCHAR *a_szFileName, TINT a_iLineNum)
Allocates memory from a specific memory block.
void TFree(void *a_pMem)
Frees previously allocated memory.
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
std::unordered_map< Key, T, std::hash< Key >, std::equal_to< Key >, Toshi::STL::TAllocator< std::pair< const Key, T > > > UnorderedMap
constexpr Scope< T > CreateScope(Args &&... args)
std::map< Key, T, std::less< Key >, Toshi::STL::TAllocator< std::pair< const Key, T > > > Map
constexpr Ref< T > CreateRef(Args &&... args)
std::vector< T, Toshi::STL::TAllocator< T > > Vector
std::unique_ptr< T, MemoryDeleter< T > > Scope
const void * const_void_pointer
pointer allocate(size_type count)
void construct(U *ptr, Args &&... args)
void deallocate(pointer ptr, size_type count)
std::ptrdiff_t difference_type
size_type max_size() const
pointer allocate(size_type count, const_void_pointer hint)
TAllocator(const TAllocator< U > &other)
const Type * const_pointer
void operator()(Type *ptr)