Skip to content

Instantly share code, notes, and snippets.

@JesseKPhillips
JesseKPhillips / StructOptions-eg.d
Last active October 16, 2019 15:55 — forked from run-dlang/main.d
Example of Meta Programming to Use Structures to define getopt command line arguments.
import std.traits;
import std.getopt;
// Specify The Parameter Structure
struct Options
{
@Option("threads", "t")
@Help("Number of threads to use.")
size_t threads;
@JesseKPhillips
JesseKPhillips / CheeseWiz.d
Last active July 7, 2019 16:24 — forked from run-dlang/main.d
Code shared from run.dlang.io.
import std.stdio, std.traits;
struct ModelA
{
// D only allows single inheritance, must use interfaces
interface iAnimal
{
string Type();
string Name();
void Attack(iAnimal who);