Section: 25.7.15.2 [range.join.with.view] Status: NAD Submitter: Hewill Kang Opened: 2023-08-21 Last modified: 2024-06-24
Priority: 3
View all other issues in [range.join.with.view].
View all issues with NAD status.
Discussion:
The issue that concat_view
implicitly breaks equality-preserving by concatenating range of references with range
of prvalues seems to be reflected in join_view
as well.
string&&
and the reference of the pattern range is prvalue
string
, dereferencing its iterator will move the elements of the inner range to the returned string
,
which makes the second dereference get an empty string
(demo):
vector v1{"hello"s};
vector v2{"world"s};
vector v{v1 | views::as_rvalue, v2 | views::as_rvalue};
auto pattern = views::iota(0, 1) | views::transform([](int) { return ", "s; });
ranges::forward_range auto joined = v | views::join_with(pattern);
fmt::print("{}\n", joined); // ["hello", ", ", "world"]
fmt::print("{}\n", joined); // ["", ", ", ""]
Not sure if we should ban such less common case.
[2023-10-30; Reflector poll]
Set priority to 3 after reflector poll. Send to SG9.
[2024-03-19; Tokyo: feedback from SG9]
SG9 believe that LWG3971 is a use-after-move and is working as intended.
We further believe that matching the behavior of concat_view
(which is the current behavior) is important. This is not a defect.
[St. Louis 2024-06-24 Status changed: Open → NAD.]
Proposed resolution: