Codechange: use std::sort() for all std::vector types

This commit is contained in:
glx
2019-04-12 01:28:11 +02:00
committed by PeterN
parent 5b77102b63
commit 801cbea9cc
5 changed files with 24 additions and 25 deletions

View File

@@ -154,10 +154,10 @@ void WindowDesc::LoadFromConfig()
/**
* Sort WindowDesc by ini_key.
*/
static int CDECL DescSorter(WindowDesc * const *a, WindowDesc * const *b)
bool WindowDesc::operator< (WindowDesc * const &other) const
{
if ((*a)->ini_key != nullptr && (*b)->ini_key != nullptr) return strcmp((*a)->ini_key, (*b)->ini_key);
return ((*b)->ini_key != nullptr ? 1 : 0) - ((*a)->ini_key != nullptr ? 1 : 0);
if (this->ini_key != nullptr && other->ini_key != nullptr) return strcmp(this->ini_key, other->ini_key) < 0;
return this->ini_key != nullptr;
}
/**
@@ -166,7 +166,7 @@ static int CDECL DescSorter(WindowDesc * const *a, WindowDesc * const *b)
void WindowDesc::SaveToConfig()
{
/* Sort the stuff to get a nice ini file on first write */
QSortT(_window_descs->data(), _window_descs->size(), DescSorter);
std::sort(_window_descs->begin(), _window_descs->end());
IniFile *ini = new IniFile();
ini->LoadFromDisk(_windows_file, NO_DIRECTORY);