projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b0a891f
)
added: `iter.empty`
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Sat, 13 May 2023 17:37:06 +0000
(12:37 -0500)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Sat, 13 May 2023 17:37:06 +0000
(12:37 -0500)
core/container/iter.onyx
patch
|
blob
|
history
diff --git
a/core/container/iter.onyx
b/core/container/iter.onyx
index 80f04ed98865784789ddb4b8708de4fbf63f079f..5e37c928919e5b0a57341159bde025535a1795c1 100644
(file)
--- a/
core/container/iter.onyx
+++ b/
core/container/iter.onyx
@@
-68,6
+68,19
@@
close :: (it: Iterator) {
}
}
+
+#doc """
+ Helper function to create an iterator of a type that does not produce an values.
+"""
+empty :: ($T: type_expr) -> Iterator(T) {
+ return .{
+ // CLEANUP: Fix the compiler bug that makes this not able to a closure.
+ next = #solidify ($T: type_expr, _: rawptr) -> (T, bool) {
+ return .{}, false;
+ } { T = T }
+ };
+}
+
//
// Implicit iterator creation
//