[Memory] Inline array allocation
This commit is contained in:
parent
c37cb11d8a
commit
c4690bf49f
@ -79,11 +79,11 @@ namespace Utils
|
|||||||
this->pool.push_back(data);
|
this->pool.push_back(data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
template <typename T> T* allocate()
|
template <typename T> inline T* allocate()
|
||||||
{
|
{
|
||||||
return this->allocateArray<T>(1);
|
return this->allocateArray<T>(1);
|
||||||
}
|
}
|
||||||
template <typename T> T* allocateArray(size_t count = 1)
|
template <typename T> inline T* allocateArray(size_t count = 1)
|
||||||
{
|
{
|
||||||
return static_cast<T*>(this->allocate(count * sizeof(T)));
|
return static_cast<T*>(this->allocate(count * sizeof(T)));
|
||||||
}
|
}
|
||||||
@ -110,11 +110,11 @@ namespace Utils
|
|||||||
|
|
||||||
static void* AllocateAlign(size_t length, size_t alignment);
|
static void* AllocateAlign(size_t length, size_t alignment);
|
||||||
static void* Allocate(size_t length);
|
static void* Allocate(size_t length);
|
||||||
template <typename T> static T* Allocate()
|
template <typename T> static inline T* Allocate()
|
||||||
{
|
{
|
||||||
return AllocateArray<T>(1);
|
return AllocateArray<T>(1);
|
||||||
}
|
}
|
||||||
template <typename T> static T* AllocateArray(size_t count = 1)
|
template <typename T> static inline T* AllocateArray(size_t count = 1)
|
||||||
{
|
{
|
||||||
return static_cast<T*>(Allocate(count * sizeof(T)));
|
return static_cast<T*>(Allocate(count * sizeof(T)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user