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:38:28

On 16 June 2012 21:03, Pavol Droba <droba_at_[hidden]> wrote:
> On Mon, 11 Jun 2012 22:26:33 +0200, Mateusz Loskot <mateusz_at_[hidden]> wrote:
>> 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.

Sure, and I'm not trying either.

> 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.

Yes, it's only the matter of awareness about this behaviour.

> 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.

That is a good point indeed.

Best regards,

Mateusz Loskot,

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