Boost logo

Boost :

Subject: Re: [boost] [string_ref] Feature requests
From: Daniel James (dnljms_at_[hidden])
Date: 2012-12-29 14:27:00

On 29 December 2012 18:37, Marshall Clow <mclow.lists_at_[hidden]> wrote:
> On Dec 29, 2012, at 9:33 AM, Daniel James <dnljms_at_[hidden]> wrote:
>> On 29 December 2012 16:56, Marshall Clow <mclow.lists_at_[hidden]> wrote:
>>> but how would a string_ref constructor know that?
>> How does your existing constructor know that the length doesn't overflow?
> I think we're talking about different things here.
> I'm talking about how a string_ref constructor would know that the range defined by two iterators is contiguous

The answer to both questions is, "It doesn't. It's the programmers
responsibility". If you use a pair of string iterators that aren't
contiguous anywhere you will have problems. I don't see why this is a
special case.

> How important is the notational convenience of being able to write:
> if ( sr1 == str1 )
> and
> if ( str1 == sr1 )
> Just wondering.

The code in question is:

    boost::find(id_attributes, name)

Where id_attributes is a string of vectors, name is a string_ref,
boost::find is the range version of std::find.

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