
On Jun 11, 2012, at 1:26 PM, Mateusz Loskot wrote:
On 11 June 2012 19:09, Pavol Droba <droba@topmail.sk> wrote:
On Mon, 11 Jun 2012 16:58:40 +0200, Mateusz Loskot <mateusz@loskot.net> wrote:
I have a simple program runs boost::split against empty string. I'm testing with Boost 1.45 and later versions like 1.46 or 1.49. As stated in the // comment below, there is difference in behaviour depending on the Boost version:
// https://gist.github.com/2910461 #include <cassert> #include <string> #include <vector> #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/classification.hpp>
int main(int argc, wchar_t* argv[]) { std::wstring s; std::vector<std::wstring> a;
assert(s.empty()); boost::split(a, s, boost::is_any_of(L", "), boost::token_compress_on); // Boost 1.45: true // Boost 1.46+: false // Assertion failed: s.empty() == a.empty(), file boost_split_empty_string.cpp, line 16 assert(s.empty() == a.empty()); return 0; }
IMHO, the behaviour exposed in newer versions is a bug. Could anyone shed light on what happened in post-1.46?
Please search the boos archives. There was an extensive discussion about this particular issue.
Pavol,
You are right, there are some discussions about this behavior, For example
http://lists.boost.org/Archives/boost/2005/01/79380.php https://svn.boost.org/trac/boost/ticket/534
and others. Thanks for pointing that.
I have to admit that to me the current behavior is not intuitive. Also, I have failed to find any example of it in the docs.
Mateusz -- If you would be willing to write up a paragraph making this clear, I will put it into the docs. -- Marshall Marshall Clow Idio Software <mailto:mclow.lists@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki