This commit is contained in:
Araq 2015-03-24 22:35:32 +01:00
commit 5d132b75ef

View file

@ -1714,11 +1714,9 @@ iterator items*[T](a: set[T]): T {.inline.} =
## iterates over each element of `a`. `items` iterates only over the ## iterates over each element of `a`. `items` iterates only over the
## elements that are really in the set (and not over the ones the set is ## elements that are really in the set (and not over the ones the set is
## able to hold). ## able to hold).
var i = low(T) var i = low(T).int
if i <= high(T): while i <= high(T).int:
while true: if T(i) in a: yield T(i)
if i in a: yield i
if i >= high(T): break
inc(i) inc(i)
iterator items*(a: cstring): char {.inline.} = iterator items*(a: cstring): char {.inline.} =