diff options
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-list.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/core/slang-list.h b/source/core/slang-list.h index 187ff3109..ff756035c 100644 --- a/source/core/slang-list.h +++ b/source/core/slang-list.h @@ -448,13 +448,13 @@ namespace Slang return -1; } + bool contains(const T& val) const { return indexOf(val) != Index(-1); } + void sort() { sort([](const T& t1, const T& t2){return t1 < t2;}); } - bool contains(const T& val) const { return indexOf(val) != Index(-1); } - template<typename Comparer> void sort(Comparer compare) { @@ -463,6 +463,17 @@ namespace Slang std::sort(m_buffer, m_buffer + m_count, compare); } + void stableSort() + { + stableSort([](const T& t1, const T& t2){return t1 < t2;}); + } + + template<typename Comparer> + void stableSort(Comparer compare) + { + std::stable_sort(m_buffer, m_buffer + m_count, compare); + } + template <typename IterateFunc> void forEach(IterateFunc f) const { |
