diff options
author | Clyybber <darkmine956@gmail.com> | 2020-06-22 22:05:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 22:05:18 +0200 |
commit | 03c8bbcc6ed499c9333e1c1e946c403c1f135831 (patch) | |
tree | 15863fe550d13351812a5d6b93e8f6752f15ac1e /lib/system | |
parent | 59ba4d8c031ecd145c027c632e443c92b9c3b29d (diff) | |
download | Nim-03c8bbcc6ed499c9333e1c1e946c403c1f135831.tar.gz |
Remove outdated comment and copy of length (#14759)
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/iterators.nim | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/system/iterators.nim b/lib/system/iterators.nim index 5d8685e40..99ad6eef6 100644 --- a/lib/system/iterators.nim +++ b/lib/system/iterators.nim @@ -1,21 +1,12 @@ when defined(nimHasLentIterators) and not defined(nimWorkaround14447): - template lent2(T): untyped = - # xxx this should actually depend on T.sizeof >= thresLentSizeof - # with for example `thresLentSizeof ~= int.sizeof`: - # it may be faster to return by value for small sizes compared to - # forcing a deref; this could be adjusted using profiling. - # However, `simply using `when T.sizeof >= thresLentSizeof: lent T else: T` - # does not work, for a few reasons (eg importc types would cause CT error - # and we can't filter them out without compiles() or some magic. - lent T + template lent2(T): untyped = lent T else: template lent2(T): untyped = T iterator items*[T: not char](a: openArray[T]): lent2 T {.inline.} = ## Iterates over each item of `a`. var i = 0 - let n = len(a) - while i < n: + while i < len(a): yield a[i] inc(i) @@ -25,8 +16,7 @@ iterator items*[T: char](a: openArray[T]): T {.inline.} = # elements converted from a string (would fail in `tests/misc/thallo.nim`) # in any case there's no performance advantage of returning char by address. var i = 0 - let n = len(a) - while i < n: + while i < len(a): yield a[i] inc(i) |