How do I initialize a templated constructor?

rempas rempas at tutanota.com
Mon Aug 8 12:26:50 UTC 2022


On Monday, 8 August 2022 at 11:03:21 UTC, Dom Disc wrote:
>
> But if you only want to know the type of the parameter, you can 
> do this:
>
> ```D
> struct TestArray(ulong element_n) {
>   int[element_n] elements;
>
>   this(type)(type number)
>   {
>     pragma(msg, "The type is: " ~ type.stringof);
>   }
> }
> ```

Unfortunately this will not do as well....


More information about the Digitalmars-d-learn mailing list