This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class Ref<T> { | |
var val : T | |
init(_ v : T) {val = v} | |
} | |
struct Box<T> { | |
var ref : Ref<T> | |
init(_ x : T) { ref = Ref(x) } | |
var value: T { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func print(address o: UnsafeRawPointer ) { | |
print(String(format: "%p", Int(bitPattern: o))) | |
} | |
var array1: [Int] = [0, 1, 2, 3] | |
var array2 = array1 | |
//Print with just assign |