On 04/10/18 17:57, Nicol Bolas wrote:
>
>
> On Tuesday, April 10, 2018 at 10:45:13 AM UTC-4, Nevin ":-)" Liber wrote:
>
> On Tue, Apr 10, 2018 at 9:29 AM, Thiago Macieira
> <
thi...@macieira.org> wrote:
>
> In what way is a pair of pointers not a contiguous array?
>
>
> Contiguity is a runtime property, not a compile time property.
>
> For instance, the range string1.data()..string2.data() is not a
> contiguous range.
>
>
> True, but the same would be true for `list1.begin(), list2.end()`. The
> point is that we already have interfaces that say "if the given
> iterators don't form a valid range, UB results". There's no reason not
> to do it here.
I think the main difference stems from the common practice, where a
pointer + length indicates a contiguous range and a pair of iterators
(even if those happen to be pointers) - not necessarily so. We can argue
on whether this is a misconception or not, but at least that's the first
impression I get when I look at the code like that.
> This argument makes even less sense in light of the fact that `span`
> /has/ a two-pointer constructor.
I'm not familiar with span, but isn't it just another name for
boost::iterator_range? In that case, iterator_range does not need a
contiguous range and it is entirely possible and makes sense to have a
constructor from two iterators.