std_ops

Undocumented in source.
@optmath
enum std_ops = q{ void opUnary(string op)() scope if (op == "--" || op == "++") { mixin(op ~ "_iterator;"); } void opOpAssign(string op)(ptrdiff_t index) scope if (op == "-" || op == "+") { mixin("_iterator " ~ op ~ "= index;"); } auto opBinary(string op)(ptrdiff_t index) if (op == "+" || op == "-") { auto ret = this; mixin(`ret ` ~ op ~ `= index;`); return ret; } ptrdiff_t opBinary(string op : "-")(scope ref const typeof(this) right) scope const { return this._iterator - right._iterator; } bool opEquals()(scope ref const typeof(this) right) scope const { return this._iterator == right._iterator; } ptrdiff_t opCmp()(scope ref const typeof(this) right) scope const { static if (isPointer!Iterator) return this._iterator - right._iterator; else return this._iterator.opCmp(right._iterator); } };

Meta