Unless I am missing something or missunderstand the mechanism (very likely) Shouldn't the "1" duplicate not exist in this vector ?
chunks.erase( std::unique ( chunks.begin(), chunks.end(),
[]( std::string &s1, std::string &s2 ){
return ( s1.compare(s2) == 0 ? true : false );}),
chunks.end() );
Before Executing the above:
1 l:1
1+ l:2
1+1 l:3
1+1= l:4
+ l:1
+1 l:2
+1= l:3
1 l:1
1= l:2
= l:1
After executing the above code:
1 l:1
1+ l:2
1+1 l:3
1+1= l:4
+ l:1
+1 l:2
+1= l:3
1 l:1
1= l:2
= l:1
I have tried without a predicate (assuming std::strings that are identical would be removed). For some reason the "ones" are identified as identical? I have looked at their length (assuming a whitespace was stuck as a prefix or postfix) but they have the same length.
Am I missing something ?