Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-11-17 12:05:48

On Sat, Nov 17, 2012 at 3:55 PM, Jeffrey Lee Hellrung, Jr.
<jeffrey.hellrung_at_[hidden]> wrote:
>> contiguous_range should have data() and operator[], iterator_range
>> doesn't have them.
>> iterator_range is also problematic when constructing from literals as
>> literals are implicitly treated as arrays.
>> BTW, contiguous_range sounds like the array_ref proposal.
> What would be the advantage of having a separate array_ref class over
> partially specializing iterator_range<T*> (preserving backward
> compatibility, of course)?

Maybe nothing. Currently this doesn't work though:
std::vector<int> a;
boost::iterator_range<int*> b = a;

> I'm thinking now the latter might be sufficient,
> if indeed there is a different interface than the primary template (is
> data() that important? doesn't iterator_range already have operator[]?).

Yes, it does have operator[], my bad.

data() is frequently used to pass the range to a C-style function.


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