use system.move instead of system.shallowCopy if the GC mode requires it

This commit is contained in:
Andreas Rumpf
2019-10-03 16:46:09 +02:00
parent 68ce808db1
commit 60d64d1aef
14 changed files with 61 additions and 36 deletions

View File

@@ -325,8 +325,8 @@ proc upperBound*[T](a: openArray[T], key: T): int = upperBound(a, key, cmp[T])
## * `lowerBound proc<#lowerBound,openArray[T],T>`_
template `<-` (a, b) =
when false:
a = b
when defined(gcDestructors):
a = move b
elif onlySafeCode:
shallowCopy(a, b)
else:
@@ -587,9 +587,7 @@ proc product*[T](x: openArray[seq[T]]): seq[seq[T]] =
indexes[index] -= 1
for ni, i in indexes:
next[ni] = x[ni][i]
var res: seq[T]
shallowCopy(res, next)
result.add(res)
result.add(next)
index = 0
indexes[index] -= 1