Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-11-17 09:55:38


On Sat, Nov 17, 2012 at 2:38 AM, Olaf van der Spek <ml_at_[hidden]> wrote:

> On Fri, Nov 16, 2012 at 10:20 PM, Jeffrey Lee Hellrung, Jr.
> <jeffrey.hellrung_at_[hidden]> wrote:
> > Actually, now that I think about it, contiguous_range<T> ==
> > iterator_range<T*>, AFAICT. Maybe iterator_range<T*> might want some
> member
> > functions added for conversion to/from other contiguous ranges, and maybe
> > there are some other interface tweaks one can make specific for pointers.
>
> 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)? 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[]?).

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk