parent
22cc7c62e5
commit
bbfe6e81ad
1 changed files with 12 additions and 0 deletions
|
|
@ -743,6 +743,18 @@ proc newSeqOfCap*[T](cap: Natural): seq[T] {.
|
||||||
## ``cap``.
|
## ``cap``.
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
when not defined(JS):
|
||||||
|
proc newSeqUninitialized*[T: SomeNumber](len: Natural): seq[T] =
|
||||||
|
## creates a new sequence of type ``seq[T]`` with length ``len``.
|
||||||
|
##
|
||||||
|
## Only available for numbers types. Note that the sequence will be
|
||||||
|
## uninitialized. After the creation of the sequence you should assign
|
||||||
|
## entries to the sequence instead of adding them.
|
||||||
|
|
||||||
|
result = newSeqOfCap[T](len)
|
||||||
|
var s = cast[PGenericSeq](result)
|
||||||
|
s.len = len
|
||||||
|
|
||||||
proc len*[TOpenArray: openArray|varargs](x: TOpenArray): int {.
|
proc len*[TOpenArray: openArray|varargs](x: TOpenArray): int {.
|
||||||
magic: "LengthOpenArray", noSideEffect.}
|
magic: "LengthOpenArray", noSideEffect.}
|
||||||
proc len*(x: string): int {.magic: "LengthStr", noSideEffect.}
|
proc len*(x: string): int {.magic: "LengthStr", noSideEffect.}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue