Skip to content

Instantly share code, notes, and snippets.

@takasek
Created March 3, 2016 23:19
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 takasek/12ef7bf771768e66529d to your computer and use it in GitHub Desktop.
Save takasek/12ef7bf771768e66529d to your computer and use it in GitHub Desktop.
ジェネリクスはタプルにもなるんですよね。なんか色々応用できそう。 #CodePiece
struct Container<T> {
let value: T
}
let a = Container(value: "a")
a.value // "a"
let b = Container(value: ("b", 2))
b.value // (.0 "b", .1 2)
let c = Container(value: (hoge: true, fuga: "c"))
c.value.hoge // true
c.value.fuga // "c"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment