mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:30:14 +01:00
Support detecting begin()/end() methods for range-for loops (#7185)
This commit adds support for range-based for loops using C++ types. It's currently limited to detecting that `r.begin()` and `r.end()` are available. We should be able to add full support for methods after #7181 is merged. Support for ADL is still a work-in-progress, and will be added at a later time. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
dd7cfdb149
commit
2aaa061688
@@ -30,3 +30,10 @@ impl forall [T:! Copy & Destroy, N:! IntLiteral()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface CppRangeForIterate {
|
||||
let Iterator:! type;
|
||||
let Sentinel:! type;
|
||||
fn Begin[ref self: Self]() -> Iterator;
|
||||
fn End[ref self: Self]() -> Sentinel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user