PIString::arg() now ignore non-suitable %.
PIVector and PIDeque now use std::stable_sort
This commit is contained in:
@@ -1494,11 +1494,11 @@ public:
|
||||
//! \~\details
|
||||
//! \~english The order of equal elements is not guaranteed to be preserved.
|
||||
//! Elements are compared using operator<.
|
||||
//! Sorting provided by [std::sort](https://en.cppreference.com/w/cpp/algorithm/sort).
|
||||
//! Sorting provided by [std::stable_sort](https://en.cppreference.com/w/cpp/algorithm/stable_sort).
|
||||
//! Complexity `O(N·log(N))`.
|
||||
//! \~russian Сохранность порядка элементов, имеющих одинаковое значение, не гарантируется.
|
||||
//! Для сравнения элементов используется оператор `operator<`.
|
||||
//! Для сортировки используется функция [std::sort](https://ru.cppreference.com/w/cpp/algorithm/sort).
|
||||
//! Для сортировки используется функция [std::stable_sort](https://ru.cppreference.com/w/cpp/algorithm/stable_sort).
|
||||
//! Сложность сортировки `O(N·log(N))`.
|
||||
//! \~\code
|
||||
//! PIDeque<int> v{5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
|
||||
@@ -1507,7 +1507,7 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a sort(std::function<bool(const T &a, const T &b)> comp)
|
||||
inline PIDeque<T> & sort() {
|
||||
std::sort(begin(), end());
|
||||
std::stable_sort(begin(), end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1524,7 +1524,7 @@ public:
|
||||
//! While the signature does not need to have const &, the function must not modify the objects passed to it.
|
||||
//! The function must return `false` for identical elements,
|
||||
//! otherwise, it will lead to undefined program behavior and memory errors.
|
||||
//! Sorting provided by [std::sort](https://en.cppreference.com/w/cpp/algorithm/sort).
|
||||
//! Sorting provided by [std::stable_sort](https://en.cppreference.com/w/cpp/algorithm/stable_sort).
|
||||
//! Complexity `O(N·log(N))`.
|
||||
//! \~russian Сохранность порядка элементов, имеющих одинаковое значение, не гарантируется.
|
||||
//! Для сравнения элементов используется функция сравнения `comp`.
|
||||
@@ -1532,7 +1532,7 @@ public:
|
||||
//! второго. Сигнатура функции сравнения должна быть эквивалентна следующей: \code bool comp(const T &a, const T &b); \endcode Сигнатура
|
||||
//! не обязана содержать const &, однако, функция не может изменять переданные объекты. Функция обязана возвращать `false` для
|
||||
//! одинаковых элементов, иначе это приведёт к неопределённому поведению программы и ошибкам памяти. Для сортировки используется функция
|
||||
//! [std::sort](https://ru.cppreference.com/w/cpp/algorithm/sort). Сложность сортировки `O(N·log(N))`.
|
||||
//! [std::stable_sort](https://ru.cppreference.com/w/cpp/algorithm/stable_sort). Сложность сортировки `O(N·log(N))`.
|
||||
//! \~\code
|
||||
//! PIDeque<int> v{5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
|
||||
//! v.sort([](const int & a, const int & b){return a > b;});
|
||||
@@ -1540,7 +1540,7 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a sort()
|
||||
inline PIDeque<T> & sort(std::function<bool(const T & a, const T & b)> comp) {
|
||||
std::sort(begin(), end(), comp);
|
||||
std::stable_sort(begin(), end(), comp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1420,11 +1420,11 @@ public:
|
||||
//! \~\details
|
||||
//! \~english The order of equal elements is not guaranteed to be preserved.
|
||||
//! Elements are compared using operator<.
|
||||
//! Sorting provided by [std::sort](https://en.cppreference.com/w/cpp/algorithm/sort).
|
||||
//! Sorting provided by [std::stable_sort](https://en.cppreference.com/w/cpp/algorithm/stable_sort).
|
||||
//! Complexity `O(N·log(N))`.
|
||||
//! \~russian Сохранность порядка элементов, имеющих одинаковое значение, не гарантируется.
|
||||
//! Для сравнения элементов используется оператор `operator<`.
|
||||
//! Для сортировки используется функция [std::sort](https://ru.cppreference.com/w/cpp/algorithm/sort).
|
||||
//! Для сортировки используется функция [std::stable_sort](https://ru.cppreference.com/w/cpp/algorithm/stable_sort).
|
||||
//! Сложность сортировки `O(N·log(N))`.
|
||||
//! \~\code
|
||||
//! PIVector<int> v{5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
|
||||
@@ -1433,7 +1433,7 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a sort(std::function<bool(const T &a, const T &b)> comp)
|
||||
inline PIVector<T> & sort() {
|
||||
std::sort(begin(), end());
|
||||
std::stable_sort(begin(), end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1450,7 +1450,7 @@ public:
|
||||
//! While the signature does not need to have const &, the function must not modify the objects passed to it.
|
||||
//! The function must return `false` for identical elements,
|
||||
//! otherwise, it will lead to undefined program behavior and memory errors.
|
||||
//! Sorting provided by [std::sort](https://en.cppreference.com/w/cpp/algorithm/sort).
|
||||
//! Sorting provided by [std::stable_sort](https://en.cppreference.com/w/cpp/algorithm/stable_sort).
|
||||
//! Complexity `O(N·log(N))`.
|
||||
//! \~russian Сохранность порядка элементов, имеющих одинаковое значение, не гарантируется.
|
||||
//! Для сравнения элементов используется функция сравнения `comp`.
|
||||
@@ -1458,7 +1458,7 @@ public:
|
||||
//! второго. Сигнатура функции сравнения должна быть эквивалентна следующей: \code bool comp(const T &a, const T &b); \endcode Сигнатура
|
||||
//! не обязана содержать const &, однако, функция не может изменять переданные объекты. Функция обязана возвращать `false` для
|
||||
//! одинаковых элементов, иначе это приведёт к неопределённому поведению программы и ошибкам памяти. Для сортировки используется функция
|
||||
//! [std::sort](https://ru.cppreference.com/w/cpp/algorithm/sort). Сложность сортировки `O(N·log(N))`.
|
||||
//! [std::stable_sort](https://ru.cppreference.com/w/cpp/algorithm/stable_sort). Сложность сортировки `O(N·log(N))`.
|
||||
//! \~\code
|
||||
//! PIVector<int> v{5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
|
||||
//! v.sort([](const int & a, const int & b){return a > b;});
|
||||
@@ -1466,7 +1466,7 @@ public:
|
||||
//! \endcode
|
||||
//! \~\sa \a sort()
|
||||
inline PIVector<T> & sort(std::function<bool(const T & a, const T & b)> comp) {
|
||||
std::sort(begin(), end(), comp);
|
||||
std::stable_sort(begin(), end(), comp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -536,7 +536,7 @@ PIString PIString::minArgPlaceholder() {
|
||||
bool ok = false;
|
||||
tmp = mid(i + 1, j - i - 1);
|
||||
int cur = tmp.toInt(10, &ok);
|
||||
if (!ok) continue;
|
||||
if (!ok || tmp.isEmpty()) continue;
|
||||
if (min < 0 || min > cur) {
|
||||
min = cur;
|
||||
ret = tmp;
|
||||
|
||||
Reference in New Issue
Block a user