Fix temporary buffer for scripting conversions.

This commit is contained in:
Jeff Hutchinson 2021-09-04 21:25:11 -04:00
parent 478a04bea8
commit c16b88d709
4 changed files with 32 additions and 7 deletions

View file

@ -160,6 +160,7 @@ class Vector
void erase(U32 index, U32 count);
void erase_fast(iterator);
void clear();
void resetAndTreatAsScratchBuffer();
void compact();
void sort(compare_func f);
void fill( const T& value );
@ -529,6 +530,15 @@ template<class T> inline void Vector<T>::clear()
mElementCount = 0;
}
/// This method sets the vector as its 0 and will overwrite memory on subsequent usage.
/// Note that the current memory in use is never freed or deallocated, so only use this if the vector
/// is being used as a scratch buffer only.
template<class T> inline
void Vector<T>::resetAndTreatAsScratchBuffer()
{
mElementCount = 0;
}
template<class T> inline void Vector<T>::compact()
{
resize(mElementCount);