string to type

Виталий Фадеев vital.fadeev at gmail.com
Thu Feb 25 07:13:33 UTC 2021


On Thursday, 25 February 2021 at 06:53:28 UTC, Виталий Фадеев 
wrote:
> On Thursday, 25 February 2021 at 06:51:11 UTC, Виталий Фадеев 
> wrote:
>> Say, please,
>> how to convert string to type ?
>>
>> [...]
>
> Simple version of this question is:
>    string t = "X";
>    mixin t!();   // <-- HERE TROUBLE

I was stupid.
Solution is:
     mixin ( "mixin " ~ IFACE.stringof[ 1 .. $ ] ~ "!();" );

Thanks!


More information about the Digitalmars-d-learn mailing list