Skip to content

Instantly share code, notes, and snippets.

@zaydek-old
Last active July 31, 2017 22:01
Show Gist options
  • Save zaydek-old/a4c4acd087422fa239ce41ff13d05673 to your computer and use it in GitHub Desktop.
Save zaydek-old/a4c4acd087422fa239ce41ff13d05673 to your computer and use it in GitHub Desktop.
import std.traits, std.format, std.string, std.stdio;
void main()
{
foo();
}
enum printLiterals = q{
alias ParameterIdentifierTuple!(mixin(__FUNCTION__)) idents;
string literals;
foreach (ident; idents)
literals ~= format("%(%s%)%s", [mixin(ident)], ident != idents[$ - 1] ? ", " : "");
writefln("%s(%s)", split(__FUNCTION__, ".")[$ - 1], literals);
};
void foo(int[] arr = [-1, 2L], string str = "hi")
{
mixin(printLiterals);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment