This file contains 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; | |
import std.algorithm; | |
struct S { | |
int x[]; | |
void foo(int x) { | |
this.x ~= x; | |
} |
This file contains 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; | |
struct Test { | |
int field1; | |
string field2; | |
double field3; | |
} | |
template make_fields(size_t SIZE, fields ...) { | |
immutable string field = typeof(fields)[0].stringof ~ "[" ~ SIZE.stringof ~ "] " ~ fields[0].stringof ~ "; "; |
This file contains 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; | |
struct Test { | |
int felt1; | |
string felt2; | |
double felt3; | |
} | |
template make_fields(int SIZE, fields ...) { | |
immutable string base = typeof(fields)[0].stringof ~ "[" ~ SIZE.stringof ~ "] " ~ fields[0].stringof ~ "; "; |