On Friday, 8 August 2025 at 05:19:28 UTC, monkyyy wrote:
```d
--- s.d
struct S
{
        auto match(A...)=match_!A;
}
template match_(A...){
        auto match_(){return 1;}
}
--- main.d
import std.sumtype;
import s;

void main()
{
        S s;
        assert(s.match!(_ => _) == 1);
}
```

I like this option because it doesn't require changes in user's code (main.d). But the issue with this implementation is that `match_` doesn't have `S` parameter so it is not an equivalent to the original problem.

Reply via email to