swift - Error: Cannot find an overload for 'contains' that accepts an argument type in while loop -
why getting error:
cannot find overload 'contains' accepts argument type '[vetex], vertex'
if var child = extracted.child { var visited = [vertex]() { child.parent = nil child = child.next visited.append(child) } while contains(visited, child) == false }
your vertex
class should confirm equatable
protocol.
// class declaration class vertex : equatable { } func ==(lhs: vertex, rhs: vertex) -> bool { // implement own logic here return lhs.yourproperty == rhs.yourproperty }
this tutorial : swift comparison protocols
Comments
Post a Comment