mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-17 08:34:20 +00:00
committed by
Andreas Rumpf
parent
22cc7c62e5
commit
bbfe6e81ad
@@ -743,6 +743,18 @@ proc newSeqOfCap*[T](cap: Natural): seq[T] {.
|
||||
## ``cap``.
|
||||
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 {.
|
||||
magic: "LengthOpenArray", noSideEffect.}
|
||||
proc len*(x: string): int {.magic: "LengthStr", noSideEffect.}
|
||||
|
||||
Reference in New Issue
Block a user