diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 3fa3dcc874..08422fd9ba 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 - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // @@ -442,34 +440,6 @@ void Foam::List::transfer(SortableList& a) } -template -void Foam::sort(List& a) -{ - std::sort(a.begin(), a.end()); -} - - -template -void Foam::sort(List& a, const Cmp& cmp) -{ - std::sort(a.begin(), a.end(), cmp); -} - - -template -void Foam::stableSort(List& a) -{ - std::stable_sort(a.begin(), a.end()); -} - - -template -void Foam::stableSort(List& 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 a6bf29686a..b89f6c95a9 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -248,18 +248,6 @@ public: template List readList(Istream&); -template -void sort(List&); - -template -void sort(List&, const Cmp&); - -template -void stableSort(List&); - -template -void stableSort(List&, const Cmp&); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/containers/Lists/UList/UList.C b/src/OpenFOAM/containers/Lists/UList/UList.C index 255a91ecfe..42d00bc41e 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 + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -116,6 +118,34 @@ Foam::label Foam::UList::byteSize() const } +template +void Foam::sort(UList& a) +{ + std::sort(a.begin(), a.end()); +} + + +template +void Foam::sort(UList& a, const Cmp& cmp) +{ + std::sort(a.begin(), a.end(), cmp); +} + + +template +void Foam::stableSort(UList& a) +{ + std::stable_sort(a.begin(), a.end()); +} + + +template +void Foam::stableSort(UList& a, const Cmp& cmp) +{ + std::stable_sort(a.begin(), a.end(), cmp); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index f7db8226ff..087f685ff6 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -320,6 +320,18 @@ public: ); }; +template +void sort(UList&); + +template +void sort(UList&, const Cmp&); + +template +void stableSort(UList&); + +template +void stableSort(UList&, const Cmp&); + // Reverse the first n elements of the list template inline void reverse(UList&, const label n);