From 0441ba5fa81543c848fe33a7bd0cc71fc75fcd4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 18 Apr 2018 08:41:17 +0200 Subject: [PATCH 1/2] Work around ptr_fun deprecation (Thanks to Andreas Fabri for the patch) --- src/OpenMesh/Core/IO/reader/BaseReader.hh | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/BaseReader.hh b/src/OpenMesh/Core/IO/reader/BaseReader.hh index d1eddfc9..2ed5c35d 100644 --- a/src/OpenMesh/Core/IO/reader/BaseReader.hh +++ b/src/OpenMesh/Core/IO/reader/BaseReader.hh @@ -156,7 +156,16 @@ protected: * @return trimmed string */ static inline std::string &left_trim(std::string &_string) { - _string.erase(_string.begin(), std::find_if(_string.begin(), _string.end(), std::not1(std::ptr_fun(std::isspace)))); + + // Find out if the compiler supports CXX11 + #if ( __cplusplus >= 201103L || _MSVC_LANG >= 201103L ) + // as with CXX11 we can use lambda expressions + _string.erase(_string.begin(), std::find_if(_string.begin(), _string.end(), [](int i)->int { return ! std::isspace(i); })); + #else + // we do what we did before + _string.erase(_string.begin(), std::find_if(_string.begin(), _string.end(), std::not1(std::ptr_fun(std::isspace)))); + #endif + return _string; } @@ -168,7 +177,19 @@ static inline std::string &left_trim(std::string &_string) { * @return trimmed string */ static inline std::string &right_trim(std::string &_string) { - _string.erase(std::find_if(_string.rbegin(), _string.rend(), std::not1(std::ptr_fun(std::isspace))).base(), _string.end()); +#error "Apply the same fix here" + + // Find out if the compiler supports CXX11 + #if ( __cplusplus >= 201103L || _MSVC_LANG >= 201103L ) + // as with CXX11 we can use lambda expressions + _string.erase(std::find_if(_string.rbegin(), _string.rend(), [](int i)->int { return ! std::isspace(i); } ).base(), _string.end()); + #else + // we do what we did before + _string.erase(std::find_if(_string.rbegin(), _string.rend(), std::not1(std::ptr_fun(std::isspace))).base(), _string.end()); + #endif + + + return _string; } -- GitLab From f308270716e28b4ea0bb4d1c292904e4e13e4ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 18 Apr 2018 08:41:41 +0200 Subject: [PATCH 2/2] Work around ptr_fun deprecation (Thanks to Andreas Fabri for the patch) --- src/OpenMesh/Core/IO/reader/BaseReader.hh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OpenMesh/Core/IO/reader/BaseReader.hh b/src/OpenMesh/Core/IO/reader/BaseReader.hh index 2ed5c35d..463b9c72 100644 --- a/src/OpenMesh/Core/IO/reader/BaseReader.hh +++ b/src/OpenMesh/Core/IO/reader/BaseReader.hh @@ -177,7 +177,6 @@ static inline std::string &left_trim(std::string &_string) { * @return trimmed string */ static inline std::string &right_trim(std::string &_string) { -#error "Apply the same fix here" // Find out if the compiler supports CXX11 #if ( __cplusplus >= 201103L || _MSVC_LANG >= 201103L ) -- GitLab