mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
moved sort from List to UList
This commit is contained in:
@ -35,8 +35,6 @@ License
|
||||
#include "BiIndirectList.H"
|
||||
#include "contiguous.H"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
@ -442,34 +440,6 @@ void Foam::List<T>::transfer(SortableList<T>& a)
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::sort(List<T>& a)
|
||||
{
|
||||
std::sort(a.begin(), a.end());
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Cmp>
|
||||
void Foam::sort(List<T>& a, const Cmp& cmp)
|
||||
{
|
||||
std::sort(a.begin(), a.end(), cmp);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::stableSort(List<T>& a)
|
||||
{
|
||||
std::stable_sort(a.begin(), a.end());
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Cmp>
|
||||
void Foam::stableSort(List<T>& a, const Cmp& cmp)
|
||||
{
|
||||
std::stable_sort(a.begin(), a.end(), cmp);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
// Assignment to UList operator. Takes linear time.
|
||||
|
||||
@ -248,18 +248,6 @@ public:
|
||||
template<class T>
|
||||
List<T> readList(Istream&);
|
||||
|
||||
template<class T>
|
||||
void sort(List<T>&);
|
||||
|
||||
template<class T, class Cmp>
|
||||
void sort(List<T>&, const Cmp&);
|
||||
|
||||
template<class T>
|
||||
void stableSort(List<T>&);
|
||||
|
||||
template<class T, class Cmp>
|
||||
void stableSort(List<T>&, const Cmp&);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -30,6 +30,8 @@ License
|
||||
#include "ListLoopM.H"
|
||||
#include "contiguous.H"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -116,6 +118,34 @@ Foam::label Foam::UList<T>::byteSize() const
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::sort(UList<T>& a)
|
||||
{
|
||||
std::sort(a.begin(), a.end());
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Cmp>
|
||||
void Foam::sort(UList<T>& a, const Cmp& cmp)
|
||||
{
|
||||
std::sort(a.begin(), a.end(), cmp);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::stableSort(UList<T>& a)
|
||||
{
|
||||
std::stable_sort(a.begin(), a.end());
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Cmp>
|
||||
void Foam::stableSort(UList<T>& a, const Cmp& cmp)
|
||||
{
|
||||
std::stable_sort(a.begin(), a.end(), cmp);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
|
||||
@ -320,6 +320,18 @@ public:
|
||||
);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
void sort(UList<T>&);
|
||||
|
||||
template<class T, class Cmp>
|
||||
void sort(UList<T>&, const Cmp&);
|
||||
|
||||
template<class T>
|
||||
void stableSort(UList<T>&);
|
||||
|
||||
template<class T, class Cmp>
|
||||
void stableSort(UList<T>&, const Cmp&);
|
||||
|
||||
// Reverse the first n elements of the list
|
||||
template<class T>
|
||||
inline void reverse(UList<T>&, const label n);
|
||||
|
||||
Reference in New Issue
Block a user