Can this recursive template type with named type parameters be simplified or improved?

Hakan Aras hakan.aras at live.at
Mon Oct 22 00:22:29 UTC 2018


On Sunday, 21 October 2018 at 21:23:35 UTC, aliak wrote:
> Hi, I'm playing around with a recursive template type that 
> allows for named template parameters. The problem is that it 
> requires a lot of repetition and becomes more error prone as 
> the number of named arguments increase. So
>
> 1) Any ideas on how to make it less error prone? less 
> repetition? a better way to do this?
> 2) Right now I can only have named optional parameters. Any 
> ideas on how to make named required parameters (e.g. the first 
> type parameter of Type).
>

I don't know if this is at all helpful, but I spent an hour on 
it, so I'm going to share it:

https://pastebin.com/cGZwc649

You can wrap it in a template if you want to retain the ability 
to pass arguments without names.

Regards,
Hakan



More information about the Digitalmars-d-learn mailing list