C++ Logo


Advanced search

Re: New revision of P2728

From: Corentin Jabot <corentinjabot_at_[hidden]>
Date: Wed, 10 May 2023 23:50:28 +0200
This is the definition of borrowed range.
Ie, enable_borrowed_range is true for views known to have that property.

It is not clear to me that utf_view would benefit from being a borrowed
None of the transform_views are in particular because they store the
predicate, nor are the views whose iterators needs to know where the end is
(chunk_view on a non forward iterator istream_views, a few others)

On Wed, May 10, 2023 at 11:32 PM Tom Honermann <tom_at_[hidden]> wrote:

> On 5/10/23 4:05 PM, Corentin Jabot via SG16 wrote:
> Referring to the view in iterators is not uncommon - for example
> http://eel.is/c++draft/ranges#range.istream.iterator
> Per [range.range]p5 <http://eel.is/c++draft/range.range#5>, iterators
> produced from a borrowed range type (which utf_view is) are valid
> independently of the lifetime of the range object that produced them. Thus,
> such iterators cannot query their associated range object (but they might
> be able to query the underlying range object if known and if it is not a
> borrowed range).
> Tom.
> For the bidirectional-at-most, there is a blurb
> http://eel.is/c++draft/ranges#range.iota.iterator-1 - I think Jonathan
> was wanting to factorise that out somewhere but right now you basically
> have to copy the blob

Received on 2023-05-10 21:50:41