diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 3fa3dcc8748bb8a3fbb8e775a4510baa705ab189..08422fd9ba23333451a1123d5ebf7217b4f9bfd6 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -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. diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index a6bf29686a56ff15d07e61a26c8ee2145d351efb..b89f6c95a9f15c2bfe07eddfb3aa537a30c1d9b1 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -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&); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/containers/Lists/UList/UList.C b/src/OpenFOAM/containers/Lists/UList/UList.C index 255a91ecfecc83484da0f0f6873795e82dbf586d..42d00bc41e7ede72f47b9e4dcf9490e0891c2f33 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.C +++ b/src/OpenFOAM/containers/Lists/UList/UList.C @@ -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> diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index f7db8226ff74d5dc0efa82edc11533b372481c79..087f685ff6cf182cee3be9fe3a4c24370d3f25fa 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -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);