lift destructor for openarray (#12073)

* destroy for sink openarray
This commit is contained in:
cooldome 2019-08-28 11:07:46 +01:00 • committed by Andreas Rumpf
commit c9f49cbc0a
5 changed files with 30 additions and 13 deletions

View file

@ -175,4 +175,19 @@ proc myfuncLoop(x: int): MySeqNonCopyable =
var cc = newMySeq(i, 5.0)
result = cc
discard myfuncLoop(3)
discard myfuncLoop(3)
#------------------------------------------------------------
# Move into table via openarray
#------------------------------------------------------------
type
TableNonCopyable = object
x: seq[(string, MySeqNonCopyable)]
proc toTable(pairs: sink openArray[(string, MySeqNonCopyable)]): TableNonCopyable =
discard
let mytable = {"a": newMySeq(2, 5.0)}.toTable