Skip to content

Commit b138915

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 d72f35e commit b138915

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
@@ -403,12 +403,12 @@ bool HexStringToInt(const string &value, int32_t *output) {
403403

404404
void ToLower(string *s) {
405405
std::transform(s->begin(), s->end(), s->begin(),
406-
std::ptr_fun<int, int>(std::tolower));
406+
[](int value){return std::tolower(value);});
407407
}
408408

409409
void ToUpper(string *s) {
410410
std::transform(s->begin(), s->end(), s->begin(),
411-
std::ptr_fun<int, int>(std::toupper));
411+
[](int value){return std::toupper(value);});
412412
}
413413

414414
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)