Title
ranges::starts_with and ranges::ends_with are underspecified
Status
nad
Section
[alg.starts.with][alg.ends.with]
Submitter
Michael Schellenberger Costa

Created on 2021-09-17.00:00:00 last changed 31 months ago

Messages

Date: 2021-09-24.00:00:00

[ 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. ]

Date: 2021-09-17.00:00:00

When implementing C++23 new ranges::starts_with and ranges::ends_with for MSVC we came around some issues regarding infinite ranges.

In short, there is no possible answers to 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;")

History
Date User Action Args
2021-09-24 17:58:46adminsetmessages: + msg12077
2021-09-24 17:58:46adminsetstatus: new -> nad
2021-09-17 00:00:00admincreate