Conflict with sumtype.match
Andrey Zherikov
andrey.zherikov at gmail.com
Sun Aug 10 01:43:08 UTC 2025
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.
More information about the Digitalmars-d-learn
mailing list