Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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