Getting all types defined in a module at compile time

Ben Jones fake at fake.fake
Tue Nov 19 03:12:32 UTC 2019


On Tuesday, 19 November 2019 at 01:55:17 UTC, Paul Backus wrote:
> On Monday, 18 November 2019 at 21:48:00 UTC, Ben Jones wrote:
>> template notmodule(alias T){
>>     alias notmodule = __traits(isModule, T);
>> }
>>
>> [...]
>>
>> I get errors:
>>
>> ```
>> (on the alias notmodule line) Error: trait isModule is either 
>> invalid or not supported in alias
>> ```
>
> The result of __traits(isModule, T) is a boolean value, so the 
> line should be
>
>     enum notmodule = __traits(isModule, T);

Thanks!

Is there a good resource on D metaprogramming somewhere?  I'm 
kind of stumbling my way through things and would love to see 
some best practices laid out somewhere.


More information about the Digitalmars-d-learn mailing list