Boost logo

Boost :

Subject: Re: [boost] Result of boost::split against empty string changed in post-1.45 release
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2012-06-16 20:42:19

On 16 June 2012 22:23, Olaf van der Spek <ml_at_[hidden]> wrote:
> On Sat, Jun 16, 2012 at 10:03 PM, Pavol Droba <droba_at_[hidden]> wrote:
>> 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
>> explicit.
> It's not about that, is it? It's about the case where the input is empty.

And there seem to be more than one valid or practical approach possible, indeed.
By the way, it looks Python has chosen similar approach to Boost:

>>> "".split(',')

>>> len("".split(','))

Best regards,

Mateusz Loskot,

Boost list run by bdawes at, gregod at, cpdaniel at, john at