Fix c++11 compilation#33
Open
marques-bruno wants to merge 1 commit intoCOVESA:masterfrom
Open
Conversation
|
I was also facing this issue, but it depends on the compiler. Although setting diff --git a/src/CommonAPI/Utils.cpp b/src/CommonAPI/Utils.cpp
index 8f7f6e7..d1891f6 100644
--- a/src/CommonAPI/Utils.cpp
+++ b/src/CommonAPI/Utils.cpp
@@ -31,7 +31,7 @@ void trim(std::string& toTrim) {
std::find_if(
toTrim.begin(),
toTrim.end(),
- std::not1(std::ptr_fun(isspace))
+ [](char c) { return !std::isspace(c); }
)
);
@@ -39,7 +39,7 @@ void trim(std::string& toTrim) {
std::find_if(
toTrim.rbegin(),
toTrim.rend(),
- std::not1(std::ptr_fun(isspace))).base(),
+ [](char c) { return !std::isspace(c); }).base(),
toTrim.end()
);
} |
goncaloalmeida
suggested changes
Sep 1, 2023
Contributor
goncaloalmeida
left a comment
There was a problem hiding this comment.
@marques-bruno internally we detected the same problem, could you please use an int instead of char please?
@goncaloalmeida - Please take a look at the notes section of isspace (https://en.cppreference.com/w/cpp/string/byte/isspace#Notes). I think char is the preferred type here. Also discussed in this thread: https://stackoverflow.com/questions/44973435/stdptr-fun-replacement-for-c17 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New to this framework, just followed the "CommonAPI C D-BUS in 10 min" tutorial and ran into this compile issue.
I'm a bit surprised I'm the first one reporting this: ptr_fun is a c++03 function deprecated in c++11 and removed in c++17.