newStringOfCap implemented and used to optimize some procs
This commit is contained in:
parent
1893f4101a
commit
d2e2d71d05
10 changed files with 53 additions and 21 deletions
|
|
@ -685,7 +685,13 @@ proc newString*(len: int): string {.
|
|||
## content. One needs to fill the string character after character
|
||||
## with the index operator ``s[i]``. This procedure exists only for
|
||||
## optimization purposes; the same effect can be achieved with the
|
||||
## ``&`` operator.
|
||||
## ``&`` operator or with ``add``.
|
||||
|
||||
proc newStringOfCap*(cap: int): string {.
|
||||
magic: "NewStringOfCap", importc: "rawNewString", noSideEffect.}
|
||||
## returns a new string of length ``0`` but with capacity `cap`.This
|
||||
## procedure exists only for optimization purposes; the same effect can
|
||||
## be achieved with the ``&`` operator or with ``add``.
|
||||
|
||||
proc `&` * (x: string, y: char): string {.
|
||||
magic: "ConStrStr", noSideEffect, merge.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue