template this and traits getOverloads issue.
    BBasile via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Nov 20 07:04:12 PST 2015
    
    
  
On Friday, 20 November 2015 at 14:39:29 UTC, Alex Parrill wrote:
> Alternatively, you can use a static method and pass in the 
> instance.
Initially this solution looked awesome but when `bug()` is 
static, `&dg` returns some functions, not some delegates, which 
is a problem: this implies that I have to find the matching 
delegate type, set `.funcptr` to the value of the `dg` function, 
set `.ptr` to the value of 't'...well not so hard I guess.
But then I have no way to detect when a function is really a 
function or something that might be delegate when instantiated:
{
     auto dg = &overload;
     if (member == "bar")
     writeln(member, " ", typeof(dg).stringof);
}
--> bar void function()
--> bar void function(uint a)
> Note that `new B` will print A's members twice, because A's 
> constructor is always called and `__traits(allMembers, B)` 
> includes A's members.
Not a problem, it was already the case anyway.
But thx much for the attempt.
    
    
More information about the Digitalmars-d-learn
mailing list