Skip to content

Instantly share code, notes, and snippets.

@theoremoon
Created May 6, 2018 10:54
Show Gist options
  • Select an option

  • Save theoremoon/41c512392365c98d4d29d35385f9c6ee to your computer and use it in GitHub Desktop.

Select an option

Save theoremoon/41c512392365c98d4d29d35385f9c6ee to your computer and use it in GitHub Desktop.
メソッドチェーンの再帰でtupleに引数を貯める例
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