isTriviallyIdentical(to:)
Returns a boolean value indicating whether this dictionary is identical to other.
Declaration
func isTriviallyIdentical(to other: Dictionary<Key, Value>) -> BoolDiscussion
Two dictionary values are identical if there is no way to distinguish between them.
For any values a, b, and c:
a.isTriviallyIdentical(to: a)is alwaystrue. (Reflexivity)a.isTriviallyIdentical(to: b)impliesb.isTriviallyIdentical(to: a). (Symmetry)If
a.isTriviallyIdentical(to: b)andb.isTriviallyIdentical(to: c)are bothtrue, thena.isTriviallyIdentical(to: c)is alsotrue. (Transitivity)If
aandbareEquatable, thena.isTriviallyIdentical(b)impliesa == b.a == bdoes not implya.isTriviallyIdentical(b)
Values produced by copying the same value, with no intervening mutations, will compare identical:
let d = c
print(c.isTriviallyIdentical(to: d))
// Prints trueComparing dictionaries this way includes comparing (normally) hidden implementation details such as the memory location of any underlying dictionary storage object. Therefore, identical dictionaries are guaranteed to compare equal with ==, but not all equal dictionaries are considered identical.