From 975577fe81efb34eacf103fa417993a0253e6599 Mon Sep 17 00:00:00 2001 From: HookedBehemoth Date: Thu, 15 Dec 2022 16:22:42 +0100 Subject: [PATCH] use lambda for file sorting --- source/util/util.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/util/util.cpp b/source/util/util.cpp index b500912..fa2e78a 100755 --- a/source/util/util.cpp +++ b/source/util/util.cpp @@ -52,14 +52,12 @@ namespace inst::util { splExit(); } - struct caseInsensitiveLess : public std::binary_function< char,char,bool > { - bool operator () (char x, char y) const { - return toupper(static_cast< unsigned char >(x)) < toupper(static_cast< unsigned char >(y)); - } - }; - bool ignoreCaseCompare(const std::string &a, const std::string &b) { - return std::lexicographical_compare(a.begin(), a.end() , b.begin() ,b.end() , caseInsensitiveLess()); + const auto case_insensitive_less = [](char x, char y) { + return toupper(static_cast(x)) < toupper(static_cast(y)); + }; + + return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end(), case_insensitive_less); } std::vector getDirectoryFiles(const std::string & dir, const std::vector & extensions) {