Angus Leeming <[EMAIL PROTECTED]> writes:
| Lars, what the fuck have you done to getVectorFromString?
:-)
The fuctions description is completely bogus then, and behaves
differently from _all_ similiar functions that I have ever seen.
Delim is used in a really magic way... the function need to be
renamed and documented properly.
Turn the #if on!
On second thought, don't! I'd rather go through the sources and fix up
the cases that expects this behaviour from getVectorFromString.
|
| vector<string> const authors = getVectorFromString(author, " and ");
I'd also say that this is misuse of this function.
delim should not be "string to split on" -> use split for that, it is
"chars to use as delimiters".
| vector<string>::const_iterator cit = authors.begin();
| vector<string>::const_iterator end = authors.end();
| for (; cit != end; ++cit) {
| std::cerr << "*it = \"" << *cit << '\"' << std::endl;
| }
|
| author = "J.P. Butler and A. Tsuda"
| *it = "J.P."
| *it = "Butler"
| *it = "A."
| *it = "Tsu"
|
| author = "A. Wonhas and J.C. Vassilicos"
| *it = "A."
| *it = "Wo"
| *it = "h"
| *it = "s"
| *it = "J.C."
| *it = "V"
| *it = "ssilicos"
|
| I think that this test confirms that this:
|
| vector<string> const getVectorFromString(string const & str,
| string const & delim)
| {
| boost::char_separator<char> sep(delim.c_str());
| boost::tokenizer<boost::char_separator<char> > tokens(str, sep);
| return vector<string>(tokens.begin(), tokens.end());
| }
|
| is absolutely, totally, buggered.
actually it is working just as I planned it to work.
--
Lgb