Skip to content

Instantly share code, notes, and snippets.

@fowlmouth
Created June 25, 2013 17:11
Show Gist options
  • Save fowlmouth/5860323 to your computer and use it in GitHub Desktop.
Save fowlmouth/5860323 to your computer and use it in GitHub Desktop.
import fowltek/pointer_arithm
proc get_shiterator[T] (some: var seq[T]; idx: TSlice[int]): tuple[start,fin: ptr T] =
(some[idx.a].addr, some[idx.b].addr)
var x = @[1,2,3,4,3,2,1]
var (start,fin) = x.get_shiterator(1..5)
while start <= fin:
echo start[]
start.inc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment