Add new convenience pool allocators for arbitrary types, and use them to keep all TSymbol content in the pool, so they don't have to be deleted.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24148 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
e1dba1b59f
commit
23bcc02a20
5 changed files with 24 additions and 13 deletions
|
|
@ -98,6 +98,16 @@ inline TString* NewPoolTString(const char* s)
|
|||
return new(memory) TString(s);
|
||||
}
|
||||
|
||||
template<class T> inline T* NewPoolObject(T)
|
||||
{
|
||||
return new(GetThreadPoolAllocator().allocate(sizeof(T))) T;
|
||||
}
|
||||
|
||||
template<class T> inline T* NewPoolObject(T, int instances)
|
||||
{
|
||||
return new(GetThreadPoolAllocator().allocate(instances * sizeof(T))) T[instances];
|
||||
}
|
||||
|
||||
//
|
||||
// Pool allocator versions of vectors, lists, and maps
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue