Skip to content

Commit 1beec8a

Browse files
committed
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.
1 parent b90866c commit 1beec8a

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

common/utils/StringUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,12 @@ bool HexStringToInt(const string &value, int64_t *output) {
454454

455455
void ToLower(string *s) {
456456
std::transform(s->begin(), s->end(), s->begin(),
457-
std::ptr_fun<int, int>(std::tolower));
457+
[](int value){return std::tolower(value);});
458458
}
459459

460460
void ToUpper(string *s) {
461461
std::transform(s->begin(), s->end(), s->begin(),
462-
std::ptr_fun<int, int>(std::toupper));
462+
[](int value){return std::toupper(value);});
463463
}
464464

465465
void CapitalizeLabel(string *s) {

include/ola/ExportMap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ class BaseVariable {
7777
std::string m_name;
7878
};
7979

80-
struct VariableLessThan: public std::binary_function<BaseVariable*,
81-
BaseVariable*, bool> {
80+
struct VariableLessThan {
8281
bool operator()(BaseVariable *x, BaseVariable *y) {
8382
return x->Name() < y->Name();
8483
}

include/olad/Plugin.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ class AbstractPlugin {
107107
};
108108

109109

110-
struct PluginLessThan: public std::binary_function<AbstractPlugin*,
111-
AbstractPlugin*, bool> {
110+
struct PluginLessThan {
112111
bool operator()(AbstractPlugin *x, AbstractPlugin *y) {
113112
return x->Id() < y->Id();
114113
}

0 commit comments

Comments
 (0)