C++ Logo

sg20

Advanced search

[SG20] Which (C++23) views cannot be used when const?

From: Nicolai Josuttis <nico_at_[hidden]>
Date: Fri, 5 Nov 2021 12:38:07 +0100
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

Received on 2021-11-05 06:38:13