 let unownedSafePrimsState = PrimsState(UnownedSafeGraphNode.self)
 let unownedUnsafePrimsState = PrimsState(UnownedUnsafeGraphNode.self)
 let unmanagedPrimsState = PrimsState(UnmanagedGraphNode.self)
+let unmanagedUGRPrimsState = PrimsState(UnmanagedUGRGraphNode.self)
 
 //===----------------------------------------------------------------------===//
 //                                 Protocols

}

func ==(lhs: UnmanagedGraphNode, rhs: UnmanagedGraphNode) -> Bool {
  return lhs === rhs
}


  }
}

struct UnmanagedUGRVarBox<T : AnyObject & Hashable> {
  var _value: Unmanaged<T>

  init(_ inputValue: T) {
    _value = Unmanaged<T>.passRetained(inputValue)
  }
}

extension UnmanagedUGRVarBox : ValueBox where T : GraphNode {
  typealias ValueType = T

  func free() {
    _value.release()
  }

  var value: T { return _value._withUnsafeGuaranteedRef { $0 } }

  func withValue<Result>(_ f: (ValueType) throws -> Result) rethrows -> Result {
    try _value._withUnsafeGuaranteedRef { try f($0) }
  }
}

extension UnmanagedUGRVarBox : Equatable where T : Equatable {
}

func ==<T>(lhs: UnmanagedUGRVarBox<T>, rhs: UnmanagedUGRVarBox<T>) -> Bool {
  return lhs._value._withUnsafeGuaranteedRef { x in
    return rhs._value._withUnsafeGuaranteedRef { y in
      return x == y
    }}
}

extension UnmanagedUGRVarBox : Hashable where T : Hashable {
  func hash(into hasher: inout Hasher) {
    _value._withUnsafeGuaranteedRef {
      hasher.combine(ObjectIdentifier($0))
    }
  }
}

//===----------------------------------------------------------------------===//
//                            Graph Node Implementations
//===----------------------------------------------------------------------===//
