Making external types available to mixins

John Chapman johnch_atms at hotmail.com
Sat Nov 24 11:05:59 UTC 2018


On Friday, 23 November 2018 at 21:49:55 UTC, Kagamin wrote:
> Well, just have all factories in one module and import it, then 
> they will be visible.

They're part of another library over which I have no control, but 
yes, I could still import them all and make life easier.

> import allfactories;
> auto makeWith(string className, Args…)(auto ref Args args) {
>   mixin("return makeWith!(I", className, "Factory)(args);"); // 
> Fowarded to implementation of makeWith below
> }
>
> Or predeclare make functions in factory modules
>
> interface ICalendarFactory
> {
>   ...
> }
>
> alias makeCalendar=makeWith!ICalendarFactory;




More information about the Digitalmars-d-learn mailing list