Short list with things to finish for D2
grauzone
none at example.net
Thu Nov 19 09:08:06 PST 2009
Andrei Alexandrescu wrote:
> opBinary does solve opIndex* morass because it only adds one function
> per category, not one function per operator. For example:
>
> struct T {
> // op can be "=", "+=", "-=" etc.
> E opAssign(string op)(E rhs) { ... }
> // op can be "=", "+=", "-=" etc.
> E opIndexAssign(string op)(size_t i, E rhs) { ... }
> }
I see, that makes sense now. It shouldn't be "+=", though (rather "+"),
because it makes chaining harder.
More information about the Digitalmars-d
mailing list