Some ideas:

T{} v;

T{} w; // sets of objects of type T

T x;

// operations

v \ w; // difference

v & w; // intersection

v | w; // union

v * w; // cartesian product (if we had pairs)

v + w; // tagged union

x in v; // membership

v < w; // subset (not necessarily proper)

v > w; // superset

v == w; // equality

// casting

T[] a = cast(T[]) v; // arbitrary order

T{} v = cast(T{}) a;

T{} u = cast(T{}) x; // create a singleton set

// iteration

foreach(T x; v){...}

Note: {}'s may be an infeasible choice of syntax, this is probably more obvious to someone else.

Report this item for cleanup