3 ms·
You can work around that using a "Box" type that wraps a value in a reference: class Box<T> { var contents : T init(_ initialContents : T)
by panic 12y ago
You can work around that using a "Box" type that wraps a value in a reference:
class Box<T> {
var contents : T
init(_ initialContents : T) {
contents = initialContents
}
}
enum BinaryTree {
case Leaf
case Branch(Box<BinaryTree>, Box<BinaryTree>)
}