C++ Logo

sg20

Advanced search

Re: [SG20] [isocpp-lib-ext] Which (C++23) views cannot be used when const?

From: Tim Song <t.canens.cpp_at_[hidden]>
Date: Fri, 5 Nov 2021 07:11:21 -0500
Of the ones in P2214 tier 1:

chunk, slide, and join_with are sometimes not const-iterable.
chunk_by is never const-iterable.

On Fri, Nov 5, 2021 at 6:38 AM Nicolai Josuttis via Lib-Ext
<lib-ext_at_[hidden]> wrote:
>
> Hi,
>
> IIUC, the following C++20 views can't be used when const because you can
> only iterate over element when being not const:
>
> Always:
> filter_view
> drop_while_view
> split_view
> Sometimes:
> drop_view
> reverse_view
> join_view
>
> Now as we seem to get a lot of new views for C++23,
> could somebody tell me about the state of iterating over all these views
> when they are const?
>
> I ask, because I have to make a very important decision now for all of
> my trainings:
> I have to decide when to introduce universal/forwarding references now
> to ordinary programmers, because ranges/views made them first-class
> language features.
> In fact, I wonder whether I shouldn't even start with
> universal/forwarding references as THE reference now (teaching it
> earlier than const auto&).
>
> --
> Nicolai M. Josuttis
> www.josuttis.de
>
> _______________________________________________
> Lib-Ext mailing list
> Lib-Ext_at_[hidden]
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/lib-ext
> Link to this post: http://lists.isocpp.org/lib-ext/2021/11/21293.php

Received on 2021-11-05 07:11:58