Skip to content

Instantly share code, notes, and snippets.

@run-dlang
Created July 24, 2023 11:33
Show Gist options
  • Save run-dlang/b0195c9ef2161b009b1bab8821132235 to your computer and use it in GitHub Desktop.
Save run-dlang/b0195c9ef2161b009b1bab8821132235 to your computer and use it in GitHub Desktop.
Code shared from run.dlang.io.
import std,std.format,std.container,std.range;
//shared
class Baz { int v; this(int w) { this.v = w; }
//const bool opEquals(const Baz o) pure nothrow @safe { return this.v == o.v; }
override string toString() const pure nothrow @safe { return this.v.to!string; }
//string toString() shared const pure nothrow @safe { return this.v.to!string; }
}
//bool opEquals(Baz t,Baz o) pure nothrow { return t.v == o.v; }
void main() { //writeln("Hello D");
DList!Baz q;
Baz b1 = new Baz(123),b2 = new Baz(456);
q.insertFront(b1); q.insertFront(b2);
//foreach (e; q) writeln(e);
q.removeFront;
//foreach (e; q) writeln(e);
//writefln("%s",q);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment