This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
views::adjacent<0> should reject non-forward rangesSection: 25.7.27.1 [range.adjacent.overview], 25.7.28.1 [range.adjacent.transform.overview] Status: WP Submitter: Hewill Kang Opened: 2024-05-10 Last modified: 2024-07-08
Priority: Not Prioritized
View all other issues in [range.adjacent.overview].
View all issues with WP status.
Discussion:
Following-up LWG 4082(i) and LWG 4083(i), the current wording makes
views::adjacent<0>(r) and views::adjacent_transform<0>(r, [] { return 0; })
well-formed even when r is just an input range or an output range, which seems to be an oversight.
[2024-06-24; Reflector poll]
Set status to Tentatively Ready after six votes in favour during reflector poll.
[St. Louis 2024-06-29; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4981.
Modify 25.7.27.1 [range.adjacent.overview] as indicated:
-2- The name
views::adjacent<N>denotes a range adaptor object (25.7.2 [range.adaptor.object]). Given a subexpressionEand a constant expressionN, the expressionviews::adjacent<N>(E)is expression-equivalent to
(2.1) —
((void)E, auto(views::empty<tuple<>>))ifNis equal to0anddecltype((E))modelsforward_range,(2.2) — otherwise,
adjacent_view<views::all_t<decltype((E))>, N>(E).
Modify 25.7.28.1 [range.adjacent.transform.overview] as indicated:
-2- The name
views::adjacent_transform<N>denotes a range adaptor object (25.7.2 [range.adaptor.object]). Given subexpressionsEandFand a constant expressionN:
(2.1) — If
Nis equal to0anddecltype((E))modelsforward_range,views::adjacent_transform<N>(E, F)is expression-equivalent to((void)E, views::zip_transform(F)), except that the evaluations ofEandFare indeterminately sequenced.(2.2) — Otherwise, the expression
views::adjacent_transform<N>(E, F)is expression-equivalent toadjacent_transform_view<views::all_t<decltype((E))>, decay_t<decltype((F))>, N>(E, F).