mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Fix Xcode deprecation warning for std::ptr_fun
Replaced logic in strstrip() with a lambda to avoid deprecations: - std::ptr_fun is deprecated in C++11, removed C++17 - std::not1 is deprecated in C++17. removed C++20
This commit is contained in:
parent
1253a61340
commit
bc18ca44e6
1 changed files with 3 additions and 2 deletions
|
@ -701,8 +701,9 @@ string strreplace(const string& s, const string& o, const string& n)
|
||||||
|
|
||||||
std::string strstrip(std::string s)
|
std::string strstrip(std::string s)
|
||||||
{
|
{
|
||||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
auto notspace = [](unsigned char c) { return ! std::isspace(c); };
|
||||||
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), notspace));
|
||||||
|
s.erase(std::find_if(s.rbegin(), s.rend(), notspace).base(), s.end());
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue