J
Jakubo
Hi, I have vector<string> filled with some values.
I need to remove every item if(vec.empty() && vec[i-1].empty())
For remove all empty strings i will use:
vec.erase(remove_if(vec.begin(), vec.end(), isEmpty), vec.end())
isEmpty is simply returning string::empty()
But how to remove it only if previous item was empty as well?
For example if my vector contain values:
["some str", "", "", "", "some other", "and other", "", "next", "", ""]
I need:
["some str", "", "some other", "and other", "", "next", ""]
Thanks for any tips
Best regards
Jakub
I need to remove every item if(vec.empty() && vec[i-1].empty())
For remove all empty strings i will use:
vec.erase(remove_if(vec.begin(), vec.end(), isEmpty), vec.end())
isEmpty is simply returning string::empty()
But how to remove it only if previous item was empty as well?
For example if my vector contain values:
["some str", "", "", "", "some other", "and other", "", "next", "", ""]
I need:
["some str", "", "some other", "and other", "", "next", ""]
Thanks for any tips
Best regards
Jakub