Is it legal to dereference end() on std::views::iota?
I found some code that dereferences end() from an iota_view.
Is it legal to dereference end() on std::views::iota?
I found some code that dereferences end() from an iota_view.
Count matching elements after splitting
I want to combine std::views::split
or std::views::lazy_split
with std::ranges::count
but I cannot get it to work.
How to sum a std::range?
Is there a way to sum a C++20 range other than iterating over it?
Can’t create std::ranges::subrange with my iterator
I am trying to define an iterator that iterates through a puzzle game board cells by a given starting cell and some link representing some kind of a connection between the cells. Below I provided a sample code with the same methods but a trivial implementation that potentially should iterate over the cells with the coordinates {0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}
:
Use of both predicates and projections in ranges
Several algorithms in std::ranges
(such as count_if
, find_if
, sort
, etc.) accept both a predicate and a projection.
Why can’t I pass a std::views::join by const reference?
I have the code below (also on compiler explorer) and I’m confused about why the const Range &
versions don’t work. The compiler complains that std::range::begin (and end) don’t work.
C++20: strange difference between std::less() and std::ranges::less()
So, I have different behaviour for range and non-range versions of less
functor. That’s a minimal code example to reproduce the behaviour: