Introduce explicit copy (#15330)

This commit is contained in:
cooldome 2020-09-16 16:26:45 +01:00 • committed by GitHub
commit a3e9cc5234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View file

@ -264,6 +264,11 @@ proc move*[T](x: var T): T {.magic: "Move", noSideEffect.} =
result = x
wasMoved(x)
func copy*[T](x: T): T {.inline.} =
## make explicit copy of the argument `x`, used to signal to the compiler
## the copy is intentional
result = x
type
range*[T]{.magic: "Range".} ## Generic type to construct range types.
array*[I, T]{.magic: "Array".} ## Generic type to construct