|
@@ -28,6 +28,7 @@
|
|
|
#ifndef _PLATFORM_H_
|
|
|
#include "platform/platform.h"
|
|
|
#endif
|
|
|
+#include <algorithm>
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// 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<class T> inline void Vector<T>::merge( const T *addr, U32 count )
|
|
|
mElementCount = newSize;
|
|
|
}
|
|
|
|
|
|
+template<class T> inline void Vector<T>::reverse()
|
|
|
+{
|
|
|
+ for (U32 i = 0, j = size(); (i != j) && (i != --j); ++i)
|
|
|
+ std::swap( mArray[ i ], mArray[ j ] );
|
|
|
+}
|
|
|
+
|
|
|
//-----------------------------------------------------------------------------
|
|
|
/// Template for vectors of pointers.
|
|
|
template <class T>
|