make SortableList::sort always use stable sort

This commit is contained in:
mattijs
2008-08-20 12:10:43 +01:00
parent 7fa60e67a5
commit a65c6f234d
2 changed files with 2 additions and 26 deletions

View File

@ -86,28 +86,7 @@ void Foam::SortableList<Type>::sort()
indices_[i] = i;
}
Foam::sort(indices_, less(*this));
List<Type> tmpValues(this->size());
forAll(indices_, i)
{
tmpValues[i] = this->operator[](indices_[i]);
}
List<Type>::transfer(tmpValues);
}
template <class Type>
void Foam::SortableList<Type>::stableSort()
{
forAll(indices_, i)
{
indices_[i] = i;
}
//Foam::sort(indices_, less(*this));
Foam::stableSort(indices_, less(*this));
List<Type> tmpValues(this->size());

View File

@ -109,12 +109,9 @@ public:
//- Size the list. If grow can cause undefined indices (until next sort)
void setSize(const label);
//- Sort the list (if changed after construction time)
//- (stable) sort the list (if changed after construction time)
void sort();
//- Sort the list (if changed after construction time)
void stableSort();
// Member Operators