C++ Logo


Advanced search

Re: New revision of P2728

From: Tom Honermann <tom_at_[hidden]>
Date: Wed, 10 May 2023 17:03:13 -0500
On 5/10/23 4:50 PM, Corentin Jabot wrote:
> 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 range,
> 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)

It isn't clear to me either, but I don't have much experience with
borrowed ranges. Naïvely, I would think it needs to be a borrowed range
in order to be able to adapt a borrowed range. But perhaps that isn't
true? This might be something else that would be worth getting input
from SG9.


> 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 22:03:15