On 9/4/2016 1:48 PM, Ethan Watson wrote:
Chipping in to say that I currently do something this with Binderoo templates...
and it sucks.

What about using this template?

// Find module in which T was defined
template ModuleOf(alias T)
{
    import std.traits : moduleName;
    mixin("import " ~ moduleName!T ~ ";");
    mixin("alias ModuleOf = " ~ moduleName!T ~ ";");
}

and it only has to be written once. Yes, it uses CTFE and mixins, but it's all hidden away inside the template.
      • Re: ADL Walter Bright via Digitalmars-d
      • Re: ADL John Colvin via Digitalmars-d
      • Re: ADL Walter Bright via Digitalmars-d
      • Re: ADL Walter Bright via Digitalmars-d
    • Re: ADL Andrei Alexandrescu via Digitalmars-d
    • Re: ADL Andrei Alexandrescu via Digitalmars-d
    • Re: ADL Ethan Watson via Digitalmars-d
      • Re: ADL Walter Bright via Digitalmars-d
        • Re: ADL Ethan Watson via Digitalmars-d
  • Re: ADL Tobias Müller via Digitalmars-d
    • Re: ADL Andrei Alexandrescu via Digitalmars-d
      • Re: ADL Tobias M via Digitalmars-d
        • Re: ADL Andrei Alexandrescu via Digitalmars-d
          • Re: ADL Tobias M via Digitalmars-d
          • Re: ADL Andrei Alexandrescu via Digitalmars-d
          • Re: ADL Tobias Müller via Digitalmars-d
          • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Andrei Alexandrescu via Digitalmars-d

Reply via email to