0
var dict = Dictionary<Int64, ExternalInfo>()
エラー:「タイプのインデックスを持つ辞書 『の値を添字ことはできませんInt64の』
extension Dictionary where Key: IntegerLiteralConvertible, Value: ExternalInfo {
func contains(id: Int64) -> Bool {
return self[id] != nil
/* return self[3] != nil */ // No issue
}
mutating func remove(id: Int64) {
removeValueForKey(id)
}
}
のような上記の辞書の拡張子を作成しますこれは、両方のステートメントのためのいくつかのコンパイラレベルのエラーを投げます。何をする必要がありますか?
Cannot subscript a value of 'Dictionary with an index of type 'Int64'