On Wednesday, 22 August 2018 at 12:36:39 UTC, Simen Kjærås wrote:
Since both your opOpAssigns match equally, the compiler throws
up. The solution is to add some sort of restriction:
This doesn't happen apparently: the operator has a left and a
right side, even if both types define the operat
On Wednesday, 22 August 2018 at 13:20:01 UTC, aliak wrote:
"void opOpAssign(string op, T)(ref Tthis, const ref T x)" looks
like the wrong signature for opOpAssign.
Oh I'll put on my stupid hat now...
I realize I had copy-pasted the wrong syntax from the global
function attempt, but I swear
hoice is not as advantageous as I
think, and I may change this design from structs to classes, or
else the code duplication would be small and never subject to
change. But now I'm just trying for the sake of learning to
find out what works or not in terms of templated operator
overloading, an
On Wednesday, 22 August 2018 at 11:58:25 UTC, XavierAP wrote:
When I want to have the same operator overloading code in both
types however, I can't make it work:
From https://dlang.org/spec/operatoroverloading.html#binary:
"the one with the ‘better’ match is selected. It is an error for
both t
gn from structs to classes, or else the code
duplication would be small and never subject to change. But now
I'm just trying for the sake of learning to find out what works
or not in terms of templated operator overloading, and whether
the reason something doesn't work is by design