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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -