Hi Dan,
// FIXME -- removing all commas does too much...
- std::string::iterator se = str.end ();
- se = std::remove (str.begin (), se, ',');
- str.erase (se, str.end ());
+ str.erase (std::remove (str.begin (), str.end(), ','), str.end ());
What is the FIXME about in this code hunk? Can the code be fixed
and the comment removed?
We should keep the FIXME clause, because of locale issues.
Also, be careful about the new expression. I can't recall any
statements about defined order of evaluation for C++ function
arguments. If the rightmost str.end() is evaluated before the
leftmost str.end(), could it be problematic? Maybe there is
something about the recursive level I don't recall, but if there is
a reference that ensures order, please indicate.
This is known as the Erase-Remove idiom:
http://en.wikipedia.org/wiki/Erase-remove_idiom