On Thursday, 17 September 2020 at 22:07:54 UTC, Simen Kjærås
wrote:
Usually, that would be:
struct V {
int x;
mixin assign!"+" a;
mixin assign!"-" b;
alias opOpAssign = a.opOpAssign;
alias opOpAssign = b.opOpAssign;
}
However, I can't seem to get that working. It seems to
On Thursday, 17 September 2020 at 21:05:59 UTC, 60rntogo wrote:
struct V
{
int x;
mixin assign!"+";
// mixin assign!"-";
}
However, if I uncomment the second mixin, there is an error "v
is not a scalar, it is a V". I guess I somehow need to merge
these overloads, but I don't know how.
I suspect that this is similar to the issue I asked about here:
https://forum.dlang.org/post/vukxaqprjbyrdpiou...@forum.dlang.org, but I can't figure it out.
This compiles:
---
private mixin template assign(string op_)
{
ref auto opOpAssign(string op, this RHS)(RHS rhs) if (op == op_)
{