Skip to content

Commit

Permalink
Replace use of std::ptr_fun
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed Jun 5, 2022
1 parent 9c7e4fa commit 8f5ac34
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/showver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ static inline bool isEmptyVersion(std::string &v) {
// http://stackoverflow.com/a/217605 ------------------------------------------

static inline void ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
return !std::isspace(ch);
}));
}

static inline void rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
return !std::isspace(ch);
}).base(), s.end());
}

static inline void trim(std::string &s) {
Expand Down

0 comments on commit 8f5ac34

Please sign in to comment.