I'm trying to do this:
protocol Signumable
{
func sgn() -> Self
}
extension Signumable
{
func
sgn()
-> Self
{
let pos = 0 < self // Error
let neg = self < 0 // Error
let p = pos ? Self(1) : Self(0)
let n = neg ? Self(1) : Self(0)
return p - n
}
}
extension Double : Signumable {}
But I get
Binary operator '<' cannot be applied to operands of type 'Int' and 'Self'
I figure there should be additional constraints on Signumable.
Help would be much appreciated!
--
Rick Mann
[email protected]
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users