Skip to content

Instantly share code, notes, and snippets.

@jweinberg
Created June 8, 2014 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jweinberg/f8a85ff28de2bfd82343 to your computer and use it in GitHub Desktop.
Save jweinberg/f8a85ff28de2bfd82343 to your computer and use it in GitHub Desktop.
protocol Initializeable {
init()
}
extension Array: Initializeable {}
func create<T: Initializeable>(t: T.Type) -> T {
return t()
}
var s = create(Array<Int>)
println(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment