Created
August 16, 2015 21:37
-
-
Save leemorgan/3906cd9dcdbc14a1f9fa to your computer and use it in GitHub Desktop.
Array extension where Element: Int
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array where Element: Int { | |
func foo() { | |
} | |
} | |
var anArray = [Int]() | |
anArray.foo() // '[Int]' does not have a member named 'foo' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok. So this works...
It appears 'where' can only mark conformance to a protocol, and not that Element is of a certain type.