Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 1.10 KB | None | 0 0
  1.     class MethodSignature {
  2.         string name;
  3.         void* ptr;
  4.     }
  5.  
  6.     class MethodSignatureImp(string Name, alias Method) : MethodSignature {
  7.         this() {
  8.             this.name = Name;
  9.             this.ptr  = (cast(void function())addressOf!Method);
  10.         }
  11.     }
  12.  
  13.  
  14.     private template addressOf(alias A) {
  15.         enum addressOf = &A;
  16.     }
  17.  
  18.  
  19.  
  20. ///=========== called like
  21.                             foreach (o; __traits(getOverloads, T, member)) {
  22.                                 static if (!is(ReturnType!(typeof(&o)) U == inout U) && !is(ReturnType!(typeof(&o)) U == inout U[]) && !__traits(isStaticFunction, o)) {
  23.                                     static if (o.mangleof.length > T.mangleof.length && T.mangleof[1 .. $] == o.mangleof[2 .. T.mangleof.length + 1]) {
  24.                                         pragma(msg, "      -  " ~ o.mangleof[T.mangleof.length + 1 .. $]);
  25.                                         //auto a = &(__traits(getOverloads, T, member)[0]);
  26.  
  27.                                         ret ~= new MethodSignatureImp!(o.mangleof[T.mangleof.length + 1 .. $], o);
  28.                                     }
  29.                                 }
  30.                             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement