mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
@@ -112,8 +112,11 @@ proc `[]`*[Idx, T; U, V: Ordinal](a: array[Idx, T], x: HSlice[U, V]): seq[T] {.s
|
||||
## ```
|
||||
let xa = a ^^ x.a
|
||||
let L = (a ^^ x.b) - xa + 1
|
||||
result = newSeq[T](L)
|
||||
# Workaround bug #22852:
|
||||
result = newSeq[T](if L < 0: 0 else: L)
|
||||
for i in 0..<L: result[i] = a[Idx(i + xa)]
|
||||
# Workaround bug #22852
|
||||
discard Natural(L)
|
||||
|
||||
proc `[]=`*[Idx, T; U, V: Ordinal](a: var array[Idx, T], x: HSlice[U, V], b: openArray[T]) {.systemRaisesDefect.} =
|
||||
## Slice assignment for arrays.
|
||||
|
||||
Reference in New Issue
Block a user