Closed
Description
Checklist
- Reviewed the README and documents.
- Searched existing issues for ensure not duplicated.
Description
Similar to the conditional Equatable
conformance Array<T: ContentEquatable>
should also conditionally conform to ContentEquatable
.
Motivation and Context
This potentially simplifies the implementation of ContentEquatable
and thus Differentiable
of a container type, if it contains an array of equatable/differentiable items.
Proposed Solution
extension Array: ContentEquatable where Element: ContentEquatable {
@inlinable
public func isContentEqual(to source: Array<Element>) -> Bool {
return count == source.count
&& zip(self, source).allSatisfy { $0.isContentEqual(to: $1) }
}
}
Metadata
Metadata
Assignees
Labels
No labels