Adaptation

Paolo Invernizzi paolo.invernizzi at gmail.com
Wed Oct 9 09:19:26 PDT 2013


Hi all,

I think this is not possible, but I'm using two different 
templated libraries, and I'm wondering if there's a way of 
adapting that:

     module external.foo;
     struct Foo { Foo[] foos }

     module external.spam;
     void spammer(T foolike){ foreach(s; foolike.spams){ ... } }

     module mymain;
     import external.foo, external.spam;

     auto spams(ref Foo foo){ return foo.foos; }

     void main(){
         spammer(Foo()); // nope, the function is not visible in 
module external.spam
     }

What I'm searching is something like:

     alias Foo.spams = Foo.foos;

But I guess that this is against every golden rule of good 
programming...

Thanks,
---
Paolo



More information about the Digitalmars-d-learn mailing list