Skip to content

Commit

Permalink
Replace deprecated pre-C++11 code
Browse files Browse the repository at this point in the history
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 OpenLightingProject#1889 this removes all warnings on recent compilers.
  • Loading branch information
aroffringa committed Aug 21, 2023
1 parent 96aa95e commit c53a932
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions common/utils/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, int>(std::tolower));
[](int value){return std::tolower(value);});
}

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

void CapitalizeLabel(string *s) {
Expand Down
3 changes: 1 addition & 2 deletions include/ola/ExportMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ class BaseVariable {
std::string m_name;
};

struct VariableLessThan: public std::binary_function<BaseVariable*,
BaseVariable*, bool> {
struct VariableLessThan {
bool operator()(BaseVariable *x, BaseVariable *y) {
return x->Name() < y->Name();
}
Expand Down
3 changes: 1 addition & 2 deletions include/olad/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ class AbstractPlugin {
};


struct PluginLessThan: public std::binary_function<AbstractPlugin*,
AbstractPlugin*, bool> {
struct PluginLessThan {
bool operator()(AbstractPlugin *x, AbstractPlugin *y) {
return x->Id() < y->Id();
}
Expand Down

0 comments on commit c53a932

Please sign in to comment.