Skip to content

Instantly share code, notes, and snippets.

@Jaffe-
Jaffe- / gist:b027287a884fc2e173a65601ec242676
Created Apr 10, 2017
Forwarding to calls to objects of different class/struct
View gist:b027287a884fc2e173a65601ec242676
import std.stdio;
import std.algorithm;
struct S {
int x[];
void foo(int x) {
this.x ~= x;
}
@Jaffe-
Jaffe- / parallel.d
Created Oct 14, 2013
Parallel arrays implementation
View parallel.d
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 ~ "; ";
@Jaffe-
Jaffe- / gist:6982317
Created Oct 14, 2013
Parallel array test
View gist:6982317
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 ~ "; ";