diff --git a/Engine/source/core/util/tVector.h b/Engine/source/core/util/tVector.h index 457ac5245..6f92bffe4 100644 --- a/Engine/source/core/util/tVector.h +++ b/Engine/source/core/util/tVector.h @@ -28,6 +28,7 @@ #ifndef _PLATFORM_H_ #include "platform/platform.h" #endif +#include //----------------------------------------------------------------------------- // Helper definitions for the vector class. @@ -181,6 +182,9 @@ class Vector /// void merge( const T *addr, U32 count ); + // Reverses the order of elements. + void reverse(); + /// @} }; @@ -760,6 +764,12 @@ template inline void Vector::merge( const T *addr, U32 count ) mElementCount = newSize; } +template inline void Vector::reverse() +{ + for (U32 i = 0, j = size(); (i != j) && (i != --j); ++i) + std::swap( mArray[ i ], mArray[ j ] ); +} + //----------------------------------------------------------------------------- /// Template for vectors of pointers. template