Re: Conflict with sumtype.match

2025-08-07 Thread monkyyy via Digitalmars-d-learn
On Friday, 8 August 2025 at 04:40:14 UTC, Andrey Zherikov wrote: I have a template similar to `sumtype.match`: ```d --- s.d struct S {} template match(A...) { auto match(S){return 1;} } --- main.d //import std.sumtype; // uncomment to get error import s; void main() { S s; asser

Conflict with sumtype.match

2025-08-07 Thread Andrey Zherikov via Digitalmars-d-learn
I have a template similar to `sumtype.match`: ```d --- s.d struct S {} template match(A...) { auto match(S){return 1;} } --- main.d //import std.sumtype; // uncomment to get error import s; void main() { S s; assert(s.match!(_ => _) == 1); } ``` If I uncomment `import std.symtype

Re: Passing template alias to a function

2025-08-07 Thread Andrey Zherikov via Digitalmars-d-learn
On Thursday, 7 August 2025 at 17:38:41 UTC, monkyyy wrote: On Thursday, 7 August 2025 at 17:33:07 UTC, monkyyy wrote: Note I believe `getBargs` will break if H ever doesnt contain a T so despite your trying to hide implementation details your exposing them all the same Thanks for your ans

Re: Passing template alias to a function

2025-08-07 Thread monkyyy via Digitalmars-d-learn
On Thursday, 7 August 2025 at 16:58:34 UTC, Andrey Zherikov wrote: On Wednesday, 6 August 2025 at 23:58:03 UTC, monkyyy wrote: ```d struct A(T) {} struct H(T) {} alias B(T) = A!(H!T); void f(T)(A!(H!T) b) {} void g(T)(A!T b) {} void h(B_)(B_ b)if(is(B_==A!(H!T),T)){} unittest{ f(B!string.i

Re: Passing template alias to a function

2025-08-07 Thread monkyyy via Digitalmars-d-learn
On Thursday, 7 August 2025 at 17:33:07 UTC, monkyyy wrote: Note I believe `getBargs` will break if H ever doesnt contain a T so despite your trying to hide implementation details your exposing them all the same

Re: Passing template alias to a function

2025-08-07 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 6 August 2025 at 23:58:03 UTC, monkyyy wrote: ```d struct A(T) {} struct H(T) {} alias B(T) = A!(H!T); void f(T)(A!(H!T) b) {} void g(T)(A!T b) {} void h(B_)(B_ b)if(is(B_==A!(H!T),T)){} unittest{ f(B!string.init); g(B!int.init); h(B!bool.init); } ``` I dont think you