> so when you explicitly call system.move(arg) the arg must still be mutable.
@Araq, thanks for that, so we need to declare it as the following then:
proc split[T](things: sink seq[T]): tuple[even, odd: seq[T]] =
var counter = newTableCount[T]()
for thing in things:
inc(counter[move thing])
for thing, count in counter:
if count mod 2 == 0:
result.even.add(move thing)
else:
result.odd.add(move thing)
Run
and call it something like the following?:
var thngs = @["red", "blue", "green", "red", "green", "red"] # last use of
sent to proc...
doAssert thngs.split == (@["green"], @["red", "blue"])
Run
Would it be necessary to use the move when calling "split" as in
thngs.move.split or will it be called automatically because of last use of?