0

This is inspired by this question where the author was unable to call ranges::begin() on a const filter_view. The answer states that this is because begin() may alter the internal state of the filter_view.

Are there any other views on which, when declared immutable, we cannot call begin(), end(), or their read-only counterparts?

theejazz
  • 41
  • 5
  • 1
    From https://stackoverflow.com/a/71183968/11638718: `filter_view`, `drop_while_view`, `split_view` and `chunk_by_view` are *never* const-iterable since they do not have a const-qualified `begin()`. – 康桓瑋 Mar 03 '22 at 05:27
  • Thanks @康桓瑋! That's exactly what I was looking for – theejazz Mar 03 '22 at 05:53
  • Does this answer your question? [Why must a std::ranges::filter\_view object be non-const for querying its elements?](https://stackoverflow.com/questions/67667318/why-must-a-stdrangesfilter-view-object-be-non-const-for-querying-its-element) – PolyGlot Apr 20 '22 at 11:36
  • @PolyGlot The accepted answer doesn't, but the second answer does. – theejazz Apr 21 '22 at 13:05

0 Answers0