switch StrPair() over to _ for member vars

This commit is contained in:
Lee Thomason 2012-10-12 10:09:48 -07:00
parent 120b3a62be
commit ed5c879dfe
1 changed files with 15 additions and 15 deletions

View File

@ -189,31 +189,31 @@ class DynArray
{ {
public: public:
DynArray< T, INIT >() { DynArray< T, INIT >() {
mem = pool; _mem = pool;
allocated = INIT; allocated = INIT;
size = 0; size = 0;
} }
~DynArray() { ~DynArray() {
if ( mem != pool ) { if ( _mem != pool ) {
delete [] mem; delete [] _mem;
} }
} }
void Push( T t ) { void Push( T t ) {
EnsureCapacity( size+1 ); EnsureCapacity( size+1 );
mem[size++] = t; _mem[size++] = t;
} }
T* PushArr( int count ) { T* PushArr( int count ) {
EnsureCapacity( size+count ); EnsureCapacity( size+count );
T* ret = &mem[size]; T* ret = &_mem[size];
size += count; size += count;
return ret; return ret;
} }
T Pop() { T Pop() {
return mem[--size]; return _mem[--size];
} }
void PopArr( int count ) { void PopArr( int count ) {
@ -227,12 +227,12 @@ public:
T& operator[](int i) { T& operator[](int i) {
TIXMLASSERT( i>= 0 && i < size ); TIXMLASSERT( i>= 0 && i < size );
return mem[i]; return _mem[i];
} }
const T& operator[](int i) const { const T& operator[](int i) const {
TIXMLASSERT( i>= 0 && i < size ); TIXMLASSERT( i>= 0 && i < size );
return mem[i]; return _mem[i];
} }
int Size() const { int Size() const {
@ -244,11 +244,11 @@ public:
} }
const T* Mem() const { const T* Mem() const {
return mem; return _mem;
} }
T* Mem() { T* Mem() {
return mem; return _mem;
} }
private: private:
@ -256,16 +256,16 @@ private:
if ( cap > allocated ) { if ( cap > allocated ) {
int newAllocated = cap * 2; int newAllocated = cap * 2;
T* newMem = new T[newAllocated]; T* newMem = new T[newAllocated];
memcpy( newMem, mem, sizeof(T)*size ); // warning: not using constructors, only works for PODs memcpy( newMem, _mem, sizeof(T)*size ); // warning: not using constructors, only works for PODs
if ( mem != pool ) { if ( _mem != pool ) {
delete [] mem; delete [] _mem;
} }
mem = newMem; _mem = newMem;
allocated = newAllocated; allocated = newAllocated;
} }
} }
T* mem; T* _mem;
T pool[INIT]; T pool[INIT];
int allocated; // objects allocated int allocated; // objects allocated
int size; // number objects in use int size; // number objects in use