Baseline: tree as shared
This commit is contained in:
commit
659c03bbf8
1471 files changed
+990535
No files matched your search
@@ -0,0 +1,25 @@
|
||||
# probe: when a List of values is destroyed, in what order do its elements go?
|
||||
struct Loud(Copyable, Movable):
|
||||
var name: String
|
||||
|
||||
def __init__(out self, name: String):
|
||||
self.name = name
|
||||
print("init", name)
|
||||
|
||||
def __init__(out self, *, copy: Self):
|
||||
self.name = copy.name + "'"
|
||||
print("copy", copy.name)
|
||||
|
||||
def __init__(out self, *, deinit move: Self):
|
||||
self.name = move.name^
|
||||
print("move", self.name)
|
||||
|
||||
def __deinit__(deinit self):
|
||||
print("destroy", self.name)
|
||||
|
||||
|
||||
def main():
|
||||
var l = List[Loud]()
|
||||
l.append(Loud("one"))
|
||||
l.append(Loud("two"))
|
||||
print("list built", len(l))
|
||||
Reference in new issue
Block a user