mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: Reinstate reverse() function in UList
This commit is contained in:
@ -348,6 +348,10 @@ void stableSort(UList<T>&, const Cmp&);
|
|||||||
template<class T>
|
template<class T>
|
||||||
void shuffle(UList<T>&);
|
void shuffle(UList<T>&);
|
||||||
|
|
||||||
|
// Reverse the first n elements of the list
|
||||||
|
template<class T>
|
||||||
|
inline void reverse(UList<T>&, const label n);
|
||||||
|
|
||||||
// Reverse all the elements of the list
|
// Reverse all the elements of the list
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void reverse(UList<T>&);
|
inline void reverse(UList<T>&);
|
||||||
|
|||||||
@ -25,7 +25,6 @@ License
|
|||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
#include "pTraits.H"
|
#include "pTraits.H"
|
||||||
#include "ListOps.H"
|
|
||||||
#include "Swap.H"
|
#include "Swap.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -319,10 +318,19 @@ inline bool Foam::UList<T>::empty() const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline void Foam::reverse(UList<T>& ul, const label n)
|
||||||
|
{
|
||||||
|
for (int i=0; i<n/2; i++)
|
||||||
|
{
|
||||||
|
Swap(ul[i], ul[n-1-i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::reverse(UList<T>& ul)
|
inline void Foam::reverse(UList<T>& ul)
|
||||||
{
|
{
|
||||||
inplaceReverseList(ul);
|
reverse(ul, ul.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user