Memory management hygiene: Use compare() instead of substr(), and put a few more things intrinsically in the memory pool.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23467 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-10-11 16:28:43 +00:00
parent 3afe67dcc2
commit 4c70685382
10 changed files with 45 additions and 41 deletions

View file

@ -91,7 +91,7 @@ namespace glslang {
// Pool version of string.
//
typedef pool_allocator<char> TStringAllocator;
typedef std::basic_string <char, std::char_traits<char>, TStringAllocator > TString;
typedef std::basic_string <char, std::char_traits<char>, TStringAllocator> TString;
inline TString* NewPoolTString(const char* s)
{
void* memory = GetThreadPoolAllocator().allocate(sizeof(TString));
@ -103,6 +103,8 @@ inline TString* NewPoolTString(const char* s)
//
template <class T> class TVector : public std::vector<T, pool_allocator<T> > {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
typedef typename std::vector<T, pool_allocator<T> >::size_type size_type;
TVector() : std::vector<T, pool_allocator<T> >() {}
TVector(const pool_allocator<T>& a) : std::vector<T, pool_allocator<T> >(a) {}