why does this not work when the struct is local to a function?
func f()
{
struct Pair:Hashable, Comparable
{
let x:Int, y:Int
static
func < (lhs:Pair, rhs:Pair) -> Bool
{
if lhs.y < rhs.y
{
return true
}
else if lhs.y == rhs.y
{
return lhs.x < rhs.x
}
else
{
return false
}
}
}
}
:3:12: error: type 'Pair' does not conform to protocol 'Comparable'
struct Pair:Hashable, Comparable
^