Created
July 4, 2016 12:45
-
-
Save sinsoku/dfefcda77651e2725adf396372b4f945 to your computer and use it in GitHub Desktop.
これはできた
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
| 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