Created
March 30, 2023 09:56
-
-
Save sp1ritCS/14c0cc891918d58e1af00622f64ee08a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 64ac4502e227c02a632f326fab6116788e8840b9 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Florian=20=22sp1rit=22=E2=80=8B?= <sp1rit@disroot.org> | |
Date: Thu, 30 Mar 2023 11:55:11 +0200 | |
Subject: [PATCH] fix wierd osx issue with cxx17 | |
MIME-Version: 1.0 | |
Content-Type: text/plain; charset=UTF-8 | |
Content-Transfer-Encoding: 8bit | |
Signed-off-by: Florian "sp1rit" <sp1rit@disroot.org> | |
--- | |
src/utils/string_utils.h | 12 ++---------- | |
1 file changed, 2 insertions(+), 10 deletions(-) | |
diff --git a/src/utils/string_utils.h b/src/utils/string_utils.h | |
index 2244356..45364cd 100644 | |
--- a/src/utils/string_utils.h | |
+++ b/src/utils/string_utils.h | |
@@ -78,21 +78,13 @@ inline std::wstring& tolower(std::wstring& src) { | |
/** Ignore left side whitespace in a string */ | |
inline std::string& ltrim(std::string& s) { | |
-#if CLATEX_CXX17 | |
- s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not_fn<int(int)>(isspace))); | |
-#else | |
- s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::cref<int(int)>(isspace)))); | |
-#endif | |
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char c) { return !isspace(c); })); | |
return s; | |
} | |
/** Ignore right side whitespace in a string */ | |
inline std::string& rtrim(std::string& s) { | |
-#if CLATEX_CXX17 | |
- s.erase(std::find_if(s.rbegin(), s.rend(), std::not_fn<int(int)>(isspace)).base(), s.end()); | |
-#else | |
- s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::cref<int(int)>(isspace))).base(), s.end()); | |
-#endif | |
+ s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char c) { return !isspace(c); }).base(), s.end()); | |
return s; | |
} | |
-- | |
2.40.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment