Subject: Re: [boost] Result of boost::split against empty string changed in post-1.45 release
From: Pavol Droba (droba_at_[hidden])
Date: 2012-06-16 16:03:30
On Mon, 11 Jun 2012 22:26:33 +0200, Mateusz Loskot <mateusz_at_[hidden]>
> You are right, there are some discussions about this behavior,
> For example
> 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.
I will not argue whether the behavior is intuitive or not. Unfortunately
this term is different from person to person.
Important is that the current setup is "correct". It follows a well defined
constraint and it is deterministic.
And actually the rationale behind it is quite simple. Imagine that you
are parsing a CSV file. You need to get the exactly same number
of elements regardless whether the last token is empty or not.
It is much easier to remove the empty tokens than to guess whether
they were supposed to be in the result or not.
On the other hand, you are right, the documentation should be more
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk