ranges::starts_with
and ranges::ends_with
are underspecifiedSection: 26.6.16 [alg.starts.with], 26.6.17 [alg.ends.with] Status: NAD Submitter: Michael Schellenberger Costa Opened: 2021-09-17 Last modified: 2021-09-24
Priority: Not Prioritized
View all issues with NAD status.
Discussion:
When implementing C++23 new ranges::starts_with
and ranges::ends_with
for MSVC we came around some issues regarding infinite ranges.
ends_with
, if the second range is infinite. Similarly, there
is no meaningful answer to starts_with
if both ranges are infinite.
We should constraint both algorithms to forbid those corner cases (preferred resolution), or explicitly specify a
given return value for those (The reasonable choice would be "return false;
")
[2021-09-24 infinite ranges are invalid by [iterator.requirements.general] p10, so undefined by p12. Might be nice to relax this in future, but needs a paper. Status changed: New → NAD.]
Proposed resolution: