Skip to content

Instantly share code, notes, and snippets.

@sinsoku
Created July 4, 2016 12:45
Show Gist options
  • Select an option

  • Save sinsoku/dfefcda77651e2725adf396372b4f945 to your computer and use it in GitHub Desktop.

Select an option

Save sinsoku/dfefcda77651e2725adf396372b4f945 to your computer and use it in GitHub Desktop.
これはできた
struct Container<T> {
var obj: T
}
func factory<T>(objects: T...) -> Array<Container<T>> {
return objects.map { Container<T>(obj: $0) }
}
let c = factory("a", "b")
print(c.dynamicType)
//=> Array<Container<String>>
print(c)
//=> [Container<Swift.String>(obj: "a"), Container<Swift.String>(obj: "b")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment