Last active
July 31, 2017 22:01
-
-
Save zaydek-old/a4c4acd087422fa239ce41ff13d05673 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
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