This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
reverse_view does not consider simple-viewSection: 25.7.21.2 [range.reverse.view] Status: New Submitter: Hewill Kang Opened: 2026-03-27 Last modified: 2026-04-04
Priority: Not Prioritized
View other active issues in [range.reverse.view].
View all other issues in [range.reverse.view].
View all issues with New status.
Discussion:
Currently, non-const begin/end for reverse_view
are always provided.
However, when the underlying range is simple-view and common_view,
we can just provide const begin to reduce the number of template instantiations.
And it is also reasonable to only provide const end in the case of
simple-view for the same reason.
Proposed resolution:
This wording is relative to N5032.
Modify 25.7.21.2 [range.reverse.view] as indicated:
[…]namespace std::ranges { template<view V> requires bidirectional_range<V> class reverse_view : public view_interface<reverse_view<V>> { […] constexpr reverse_iterator<iterator_t<V>> begin() requires (!(simple-view<V> && common_range<const V>));constexpr reverse_iterator<iterator_t<V>> begin() requires common_range<V>;constexpr auto begin() const requires common_range<const V>; constexpr reverse_iterator<iterator_t<V>> end() requires (!simple-view<V>); constexpr auto end() const requirescommon_range<const V>; […] }; […] }constexpr reverse_iterator<iterator_t<V>> begin() requires (!(simple-view<V> && common_range<const V>));-2-Returns:
make_reverse_iterator(ranges::next(ranges::begin(base_), ranges::end(base_)))-3- Remarks: In order to provide the amortized constant time complexity required by the
rangeconcept, this function caches the result within thereverse_viewfor use on subsequent calls.constexpr reverse_iterator<iterator_t<V>> begin() requires common_range<V>;constexpr auto begin() const requires common_range<const V>;-4- Effects: Equivalent to:
return make_reverse_iterator(ranges::end(base_));constexpr reverse_iterator<iterator_t<V>> end() requires (!simple-view<V>); constexpr auto end() const requirescommon_range<const V>;-5- Effects: Equivalent to:
return make_reverse_iterator(ranges::begin(base_));