split() differences between 1.32.0 and 1.33.0
Hello, I recently upgrade from Boost 1.32.0 to 1.33.0, since I just upgraded to Mac OS X 10.4 from 10.3. I noticed a slightly different behavior in boost::algorithm::split between these two versions. If you have a trailing delimiter, like: vector<string> results; ba::split(results, ",foo,", ba::is_any_of(",")); This returns 2 elements in 1.32.0 and 3 elements in 1.33.0. Was this changed intentionally? It does seem to make more sense to return 3 elements, but it currently breaks my program. -Dave
Hi, There was a serious discussion about the semantics of split() function some time ago. According to this discussion, the behaviour has been slightly changed. The result can be described as follows: split() now always returns n+1 segments where n is a number of delimiters. Even if the segments are empty. So that new behavious is slightly different, but it should be easy to fix your code. If this is a problem for you, I suggest you to try to replace boost/algorithm/string/find_iterator.hpp with the one from the version 1.32. It should not break the other code. Best Regards, Pavol. On Mon, Nov 14, 2005 at 03:16:17PM -0600, Dave Dribin wrote:
Hello,
I recently upgrade from Boost 1.32.0 to 1.33.0, since I just upgraded to Mac OS X 10.4 from 10.3. I noticed a slightly different behavior in boost::algorithm::split between these two versions. If you have a trailing delimiter, like:
vector<string> results; ba::split(results, ",foo,", ba::is_any_of(","));
This returns 2 elements in 1.32.0 and 3 elements in 1.33.0. Was this changed intentionally? It does seem to make more sense to return 3 elements, but it currently breaks my program.
-Dave
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Nov 15, 2005, at 1:11 AM, Pavol Droba wrote:
The result can be described as follows: split() now always returns n+1 segments where n is a number of delimiters. Even if the segments are empty.
That makes sense.
So that new behavious is slightly different, but it should be easy to fix your code.
Yeah, it's easy to fix. I just need to decide if our package should require 1_33_0 or greater, or add a workaround to support 1_32_0 and 1_33_0. For now, I'm adding a #if that detects BOOST_VERSION and uses split() differently, based on that. Thanks, -Dave
I can confirm that the error has been resolved. It took me a while until I realized that I forgot to change the include path to 1.33.1 ;-) Thanks, Christian
participants (3)
-
Christian Henning
-
Dave Dribin
-
Pavol Droba