| 297 | void operator=( const DynArray& ); // not supported |
| 298 | |
| 299 | void EnsureCapacity( size_t cap ) { |
| 300 | TIXMLASSERT( cap > 0 ); |
| 301 | if ( cap > _allocated ) { |
| 302 | TIXMLASSERT( cap <= SIZE_MAX / 2 / sizeof(T)); |
| 303 | const size_t newAllocated = cap * 2; |
| 304 | T* newMem = new T[newAllocated]; |
| 305 | TIXMLASSERT( newAllocated >= _size ); |
| 306 | memcpy( newMem, _mem, sizeof(T) * _size ); // warning: not using constructors, only works for PODs |
| 307 | if ( _mem != _pool ) { |
| 308 | delete [] _mem; |
| 309 | } |
| 310 | _mem = newMem; |
| 311 | _allocated = newAllocated; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | T* _mem; |
| 316 | T _pool[INITIAL_SIZE]; |
nothing calls this directly
no outgoing calls
no test coverage detected