synthesising instantiated template parameters and arguments

Jacob Carlborg doob at me.com
Thu Oct 29 08:57:26 UTC 2020


On Wednesday, 28 October 2020 at 05:51:14 UTC, Nicholas Wilson 
wrote:

> but for a templated C this is tricker as I can't use a template 
> sequence parameter (...) unless C uses it in the same position 
> (I'm trying to generate a mangle from it so it needs to be 
> exact). Given
>
> class A(T,int,args...) {}
> alias C = A!(int, 0, float);
>
> I need `ScopeClass!C` to be
>
> template ScopeClass(C)
> {
>     class Anon(T,int,args...) // name doesn't matter
>     {
>          // implement members with compile time reflection
>     }
>
>     alias ScopeClass = Anon!(int, 0, float);
> }
>
> How do I do this?

Are you looking for `TemplateArgsOf` [1] ?

[1] https://dlang.org/phobos/std_traits.html#TemplateArgsOf

--
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list