File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =' 1.0' encoding =' utf-8' standalone =' no' ?>
2+ <!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+ <issue num =" 4184" status =" New" >
5+ <title >Domain of <code >ranges::c<i >meow</i ></code > doesn't match <code >ranges::<i >meow</i ></code ></title >
6+ <section ><sref ref =" [range.access]" /></section >
7+ <submitter >Hewill Kang</submitter >
8+ <date >17 Dec 2024</date >
9+ <priority >99</priority >
10+
11+ <discussion >
12+ <p >
13+ `ranges::begin/rbegin/data` can be used on non-ranges as long as the object has a
14+ `begin/rbegin/data` member, this is also true for their const versions before C++23.
15+ <p />
16+ However, in C++23 the const version always applied <code ><i >possibly-const-range</i ></code > to the object,
17+ which no longer worked for non-ranges due to this function requiring `input_range`,
18+ which seems to be a breaking change (<a href =" https://godbolt.org/z/KKe4nG9W8" >demo</a >):
19+ </p >
20+ <blockquote ><pre >
21+ #include < ranges>
22+
23+ struct NotRange {
24+ int* begin();
25+ const int* begin() const;
26+ int* rbegin();
27+ const int* rbegin() const;
28+ int* data();
29+ const int* data() const;
30+ };
31+
32+ int main() {
33+ NotRange r;
34+
35+ (void) std::ranges::begin(r);
36+ (void) std::ranges::rbegin(r);
37+ (void) std::ranges::data(r);
38+
39+ // <span style =" color:#C80000;font-weight:bold" >The following works in C++20, fails in C++23</span >
40+ (void) std::ranges::cbegin(r);
41+ (void) std::ranges::crbegin(r);
42+ (void) std::ranges::cdata(r);
43+ }
44+ </pre ></blockquote >
45+ </discussion >
46+
47+ <resolution >
48+ </resolution >
49+
50+ </issue >
You can’t perform that action at this time.
0 commit comments