On Tuesday, 6 June 2023 at 14:23:59 UTC, Steven Schveighoffer wrote:
On 6/5/23 11:33 AM, Basile B. wrote:
[...]

Ugh, don't do it that way. Always give opDispatch a template constraint or it will suck to use.

Also, given the problem constraints, you can build the method automatically using the string.

```d
auto opDispatch(string member, T)(auto ref T t) if(member.startsWith("set"))
{
   mixin(toLower(m[3]), m[4 .. $], " = t;");
}
```

-Steve

yeah I know that opDispatch is disliked because it is tried in a SFINAE fashion, as citicized by Adam. But on the other side it's the best opover.

Reply via email to