moved sort from List to UList

This commit is contained in:
mattijs
2009-06-25 12:03:10 +01:00
parent 7df4761068
commit 9ea05f8371
4 changed files with 42 additions and 42 deletions

View File

@ -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.

View File

@ -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&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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>

View File

@ -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);