We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a00bd10 commit 15965d6Copy full SHA for 15965d6
std/typecons.d
@@ -535,16 +535,16 @@ if (distinctFieldNames!(Specs))
535
string injectNamedFields()
536
{
537
string decl = "";
538
- foreach (i, name; staticMap!(extractName, fieldSpecs))
539
- {
540
- import std.format : format;
541
-
542
- decl ~= format("alias _%s = Identity!(field[%s]);", i, i);
543
- if (name.length != 0)
+ import std.conv : to;
+ static foreach (i, val; fieldSpecs)
+ {{
+ auto si = to!string(i);
+ decl ~= "alias _" ~ si ~ " = Identity!(field[" ~ si ~ "]);";
+ if (val.name.length != 0)
544
545
- decl ~= format("alias %s = _%s;", name, i);
+ decl ~= "alias " ~ val.name ~ " = _" ~ si ~ ";";
546
}
547
- }
+ }}
548
return decl;
549
550
0 commit comments