Re: Adding to a global AliasSeq

2023-08-18 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 12:20:54 UTC, repr_man wrote: On Tuesday, 15 August 2023 at 07:02:45 UTC, Basile B. wrote: You can add a kind of tag with the mixin, that will allow to to test if the type supplied to `f` is well a Base implementor: Firstly, thank you for your help. This is

Re: Adding to a global AliasSeq

2023-08-15 Thread repr_man via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 07:02:45 UTC, Basile B. wrote: You can add a kind of tag with the mixin, that will allow to to test if the type supplied to `f` is well a Base implementor: Firstly, thank you for your help. This is probably the best solution. Secondly, I feel very stupid for not

Re: Adding to a global AliasSeq

2023-08-15 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 02:30:37 UTC, repr_man wrote: Consider the following template mixin: ```d mixin template Base() { int x(){ return 10; } } ``` It could be used in a variety of structs as follows: ```d struct Child { mixin Base!(); } ``` Now, let's suppose we write a function

Adding to a global AliasSeq

2023-08-14 Thread repr_man via Digitalmars-d-learn
Consider the following template mixin: ```d mixin template Base() { int x(){ return 10; } } ``` It could be used in a variety of structs as follows: ```d struct Child { mixin Base!(); } ``` Now, let's suppose we write a function with a parameter that should only be able to take items