Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 12
    Why define a macro you only use in one place. And how is your UASSERT any better than standard assert. Splitting up the comparison into 3 tokens like that does nothing other than require more commas than you'd otherwise need.
    – crelbor
    Commented May 13, 2011 at 13:10
  • 1
    Maybe the UASSERT macro shows (in the error message) the actual relationship between (and values of) the two compared values? That's actually a pretty good idea, IMHO.
    – GhassanPL
    Commented Mar 17, 2012 at 17:03
  • 12
    Ugh, why doesn't the std::string class include a split() function? Commented Apr 18, 2012 at 20:34
  • I think the last line in the while loop should be start = ((end > (theString.size() - theDelimiter.size())) ? string::npos : end + theDelimiter.size()); and the while loop should be while (start != string::npos). Also, I check the substring to be sure it's not empty before inserting it into the vector.
    – John K
    Commented Jul 31, 2012 at 20:11
  • @JohnK If the input has two consecutive delimiters, then clearly the string between them is empty, and should be inserted into the vector. If empty values are not acceptable for a particular purpose, that is another thing, but IMHO such constraints should be enforced outside this kind of a very general purpose functions. Commented Jun 26, 2013 at 14:02