Browse Source

get rid of std::ptr_fun in string.hpp

master
Niklas Rosenstein 2 years ago
parent
commit
77832c456f
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
1 changed files with 4 additions and 8 deletions
  1. + 4
    - 8
      include/NiklasRosenstein/string.hpp

+ 4
- 8
include/NiklasRosenstein/string.hpp

@ -58,18 +58,14 @@ namespace niklasrosenstein {
}
/* Trims a string of whitespace from the left. */
template <class string>
inline string& ltrim(string& s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(),
std::not1(std::ptr_fun<int, int>(std::isspace))));
inline std::string& ltrim(std::string& s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [] (auto&& c) { return !std::isspace(c); }));
return s;
}
/* Trims a string of whitespace from the right. */
template <class string>
inline string& rtrim(string& s) {
s.erase(std::find_if(s.rbegin(), s.rend(),
std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
inline std::string& rtrim(std::string& s) {
s.erase(std::find_if(s.rbegin(), s.rend(), [] (auto&& c) { return !std::isspace(c); }).base(), s.end());
return s;
}

Loading…
Cancel
Save