Fix MutRange[T] problems. (#26)
This commit is contained in:
parent
49f32c604b
commit
d49a57f943
|
@ -216,19 +216,18 @@ proc tryAdvance*[T](x: var Range[T], idx: int): bool =
|
||||||
## ``false`` if you are trying to overrun range ``x``.
|
## ``false`` if you are trying to overrun range ``x``.
|
||||||
result = x.advanceImpl(idx)
|
result = x.advanceImpl(idx)
|
||||||
|
|
||||||
proc tryAdvance*[T](x: var MutRange[T], idx: int): bool =
|
proc tryAdvance*[T](x: var MutRange[T], idx: int): bool {.inline.} =
|
||||||
## Move internal start offset of range ``x`` by ``idx`` elements forward.
|
## Move internal start offset of range ``x`` by ``idx`` elements forward.
|
||||||
##
|
##
|
||||||
## Returns ``true`` if operation got completed successfully, or
|
## Returns ``true`` if operation got completed successfully, or
|
||||||
## ``false`` if you are trying to overrun range ``x``.
|
## ``false`` if you are trying to overrun range ``x``.
|
||||||
result = x.advanceImpl(idx)
|
result = tryAdvance(Range[T](x), idx)
|
||||||
|
|
||||||
proc advance*[T](x: var Range[T], idx: int) =
|
proc advance*[T](x: var Range[T], idx: int) =
|
||||||
## Move internal start offset of range ``x`` by ``idx`` elements forward.
|
## Move internal start offset of range ``x`` by ``idx`` elements forward.
|
||||||
let res = x.advanceImpl(idx)
|
let res = x.advanceImpl(idx)
|
||||||
if not res: raise newException(IndexError, "Advance Error")
|
if not res: raise newException(IndexError, "Advance Error")
|
||||||
|
|
||||||
proc advance*[T](x: var MutRange[T], idx: int) =
|
proc advance*[T](x: var MutRange[T], idx: int) {.inline.} =
|
||||||
## Move internal start offset of range ``x`` by ``idx`` elements forward.
|
## Move internal start offset of range ``x`` by ``idx`` elements forward.
|
||||||
let res = x.advanceImpl(idx)
|
advance(Range[T](x), idx)
|
||||||
if not res: raise newException(IndexError, "Advance Error")
|
|
||||||
|
|
Loading…
Reference in New Issue