Created
May 6, 2018 10:54
-
-
Save theoremoon/41c512392365c98d4d29d35385f9c6ee to your computer and use it in GitHub Desktop.
メソッドチェーンの再帰でtupleに引数を貯める例
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
| import std.stdio; | |
| auto f(T)() | |
| { | |
| class A(U...) { | |
| auto f(V)() { | |
| return new A!(U, V); | |
| } | |
| void p() { | |
| foreach (i, u; U) { | |
| writeln(i, ":", typeid(u)); | |
| } | |
| } | |
| } | |
| return new A!(T); | |
| } | |
| class T{} | |
| void main() | |
| { | |
| auto a = f!(int).f!(long).f!(string); | |
| writeln(typeid(a)); | |
| a.p(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment