P4179R0 — view_interface::[c]rbegin()
Hewill Kang
LEWGLWGSG9
This paper provides `rbegin()`/`rend()`/`crbegin()`/`crend()` methods to `ranges::view_interface`, making its interface more symmetric with the existing `cbegin()`/`cend()` members and enhancing convenience for views. Revision history R0 Initial revision. Discussion In C++23, `view_interface` added `cbegin()`/`cend()` members to improve const-correctness and interface consistency. However, it still lacks the corresponding reverse iterator members `rbegin()`/`rend()`/`crbegin()`/`crend()`, which are extremely common in the library: Reversible Ranges .rbegin() .rend() .crbegin() .crend() array/vector/inplace_vector ✅ ✅ ✅ ✅ deque/list/hive ✅ ✅ ✅ ✅ set/multiset/map/multimap ✅ ✅ ✅ ✅ flat_set/flat_multiset/flat_map/flat_multimap ✅ ✅ ✅ ✅ span/string/string_view ✅ ✅ ✅ ✅ stacktrace ✅ ✅ ✅ ✅ ranges::*meow*_view ❌ ❌ ❌ ❌ Although `back()` is provided for bidirectional views, accessing the second-to-last element or performing general reverse iteration remains inconvenient without these members. Users of custom views are therefore forced to rely on the free functions `ranges::rbegin(r)` or wrap the view with `views::reverse`: auto my_view = *some-view*; // today for (auto it = ranges::rbegin(my_v