diff options
author | cooldome <ariabushenko@gmail.com> | 2020-09-16 16:26:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-16 17:26:45 +0200 |
commit | a3e9cc52343a54cadc7b77b783e1c8b6ba2b327f (patch) | |
tree | 53b08cbbc176a3ae27ddbb35a6cbe9521a7ba104 /lib/system.nim | |
parent | ae4ede6b009632bd0d809c61066b240e8ee7719a (diff) | |
download | Nim-a3e9cc52343a54cadc7b77b783e1c8b6ba2b327f.tar.gz |
Introduce explicit copy (#15330)
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim index c05ca24dc..dbe0f11f7 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -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 |