mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
- Added method Vector::reverse().
This commit is contained in:
parent
65099897f4
commit
dea6f0a24d
1 changed files with 10 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
#ifndef _PLATFORM_H_
|
#ifndef _PLATFORM_H_
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Helper definitions for the vector class.
|
// Helper definitions for the vector class.
|
||||||
|
|
@ -181,6 +182,9 @@ class Vector
|
||||||
///
|
///
|
||||||
void merge( const T *addr, U32 count );
|
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;
|
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 for vectors of pointers.
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue