From 597bcd76a212724fa9b88518c1c1985c861cfad1 Mon Sep 17 00:00:00 2001 From: Scott R Charlton Date: Mon, 19 Aug 2019 10:40:46 -0600 Subject: [PATCH] CRAN: replaced deprecated std::ptr_fun with lambda function --- common/Parser.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/Parser.h b/common/Parser.h index 3bf093a1..1f329b4d 100644 --- a/common/Parser.h +++ b/common/Parser.h @@ -280,13 +280,21 @@ class CParser: public PHRQ_base // Global functions static inline std::string &trim_left(std::string &s) { - s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); +#if (__GNUC__ && (__cplusplus >= 201103L)) || (_MSC_VER >= 1600) + s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) {return !std::isspace(c);})); +#else + s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); +#endif return s; } static inline std::string &trim_right(std::string &s) { - s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(std::isspace))).base(), s.end()); - return s; +#if (__GNUC__ && (__cplusplus >= 201103L)) || (_MSC_VER >= 1600) + s.erase(std::find_if(s.rbegin(), s.rend(), [](int c) {return !std::isspace(c);}).base(), s.end()); +#else + s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(std::isspace))).base(), s.end()); +#endif + return s; } static inline std::string &trim(std::string &s) {