From 61256d9b8f5bc185c43ada5ca1e1d2056a2a7a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Offringa?= Date: Thu, 3 Aug 2023 20:42:04 +0200 Subject: [PATCH] Replace deprecated pre-C++11 code The functions std::binary_function and std::mem_fun have been deprecated in C++11, and are removed in C++20. This pull request replaces them with more modern code. Together with #1889 this removes all warnings on recent compilers. --- common/utils/StringUtils.cpp | 4 ++-- include/ola/ExportMap.h | 3 +-- include/olad/Plugin.h | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/common/utils/StringUtils.cpp b/common/utils/StringUtils.cpp index bc27b623fb..2897918acd 100644 --- a/common/utils/StringUtils.cpp +++ b/common/utils/StringUtils.cpp @@ -403,12 +403,12 @@ bool HexStringToInt(const string &value, int32_t *output) { void ToLower(string *s) { std::transform(s->begin(), s->end(), s->begin(), - std::ptr_fun(std::tolower)); + [](int value){return std::tolower(value);}); } void ToUpper(string *s) { std::transform(s->begin(), s->end(), s->begin(), - std::ptr_fun(std::toupper)); + [](int value){return std::toupper(value);}); } void CapitalizeLabel(string *s) { diff --git a/include/ola/ExportMap.h b/include/ola/ExportMap.h index 284eb9ae3d..3e4e810d46 100644 --- a/include/ola/ExportMap.h +++ b/include/ola/ExportMap.h @@ -77,8 +77,7 @@ class BaseVariable { std::string m_name; }; -struct VariableLessThan: public std::binary_function { +struct VariableLessThan { bool operator()(BaseVariable *x, BaseVariable *y) { return x->Name() < y->Name(); } diff --git a/include/olad/Plugin.h b/include/olad/Plugin.h index 623718a2ca..163e0ad772 100644 --- a/include/olad/Plugin.h +++ b/include/olad/Plugin.h @@ -107,8 +107,7 @@ class AbstractPlugin { }; -struct PluginLessThan: public std::binary_function { +struct PluginLessThan { bool operator()(AbstractPlugin *x, AbstractPlugin *y) { return x->Id() < y->Id(); }