Named multi-imports

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 18 07:18:04 PDT 2017


On Friday, 18 August 2017 at 09:18:42 UTC, Timon Gehr wrote:
> ---
> module util;
>
> // ...
>
> template Imports(T...){
>     import std.string,std.algorithm;
>     mixin([T].map!(x=>"public import "~x~";").join);
>     // or, starting from DMD 2.076, you could use static 
> foreach instead:
>     // static foreach(x;T) mixin("public import "~x~";");
> }
>
> // ...
>

The static foreach is nice...doesn't depend on phobos.


More information about the Digitalmars-d mailing list