     
 }
 
-public struct WeakDictionaryIndex<Key : Hashable & Comparable, Value : AnyObject> : Comparable {
+public struct WeakDictionaryReference<Key : Hashable & Comparable, Value : AnyObject> : Comparable {
     fileprivate let key: Key
     fileprivate weak var value: Value?
     
-    public static func ==(lhs: WeakDictionaryIndex, rhs: WeakDictionaryIndex) -> Bool {
+    public static func ==(lhs: WeakDictionaryReference, rhs: WeakDictionaryReference) -> Bool {
         return lhs.key == rhs.key
     }
     
-    public static func <(lhs: WeakDictionaryIndex, rhs: WeakDictionaryIndex) -> Bool {
+    public static func <(lhs: WeakDictionaryReference, rhs: WeakDictionaryReference) -> Bool {
         return lhs.key < rhs.key
     }
     
-    public static func <=(lhs: WeakDictionaryIndex, rhs: WeakDictionaryIndex) -> Bool {
+    public static func <=(lhs: WeakDictionaryReference, rhs: WeakDictionaryReference) -> Bool {
         return lhs.key <= rhs.key
     }
     
-    public static func >=(lhs: WeakDictionaryIndex, rhs: WeakDictionaryIndex) -> Bool {
+    public static func >=(lhs: WeakDictionaryReference, rhs: WeakDictionaryReference) -> Bool {
         return lhs.key >= rhs.key
     }
     
-    public static func >(lhs: WeakDictionaryIndex, rhs: WeakDictionaryIndex) -> Bool {
+    public static func >(lhs: WeakDictionaryReference, rhs: WeakDictionaryReference) -> Bool {
         return lhs.key > rhs.key
     }
 }

        return storage.index(after: i)
    }
    
    public subscript(position: Index) -> WeakDictionaryIndex<Key, Value> {
        get {
            let v = storage.values[position]
            return v


public struct WeakDictionary<Key : Hashable & Comparable, Value : AnyObject> : Collection {
    
    public typealias Index = DictionaryIndex<Key, WeakDictionaryReference<Key, Value>>
    
    private var storage: Dictionary<Key, WeakDictionaryReference<Key, Value>>
    
    public init() {
        storage = Dictionary<Key, WeakDictionaryReference<Key, Value>>()
    }
    
    private init(withStorage s: Dictionary<Key, WeakDictionaryReference<Key, Value>>) {
        storage = s
    }
    
