Bug 1839506 - Part 1: Add a parameterless overload for StableSort r=emilio

This follows the existing examples of Sort, Contains, etc.

Differential Revision: https://phabricator.services.mozilla.com/D182735
This commit is contained in:
Kagami Sascha Rosylight 2023-07-04 20:53:17 +00:00
parent a963836ce1
commit 08e5b250d0
2 changed files with 7 additions and 1 deletions

View File

@ -653,7 +653,7 @@ struct ColorLineT {
*aFirstStop = *aLastStop = aStops[0].offset;
return;
}
aStops.StableSort(nsDefaultComparator<GradientStop, GradientStop>());
aStops.StableSort();
if (aReverse) {
float a = aStops[0].offset;
float b = aStops.LastElement().offset;

View File

@ -2397,6 +2397,12 @@ class nsTArray_Impl
});
}
// A variation on the StableSort method defined above that assumes that
// 'operator<' is defined for value_type.
void StableSort() {
StableSort(nsDefaultComparator<value_type, value_type>());
}
// This method reverses the array in place.
void Reverse() {
value_type* elements = Elements();