how to get rid of "cannot deduce function from argument types" elegantly

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 14 03:05:34 PDT 2016


On Monday, 13 June 2016 at 22:54:13 UTC, Ali Çehreli wrote:
> Tree!T tree(TL, T, TR)(TL left, T node, TR right) {
>   return new Tree!T(left, node, right);
> }
>

There's also this:

     Tree!T tree(TL, T, TR)(TL left, T node, TR right) if(
         (is(TL == Tree!T) || is(TL == typeof(null))) &&
         (is(TR == Tree!T) || is(TR == typeof(null)))
     ){
       return new Tree!T(left, node, right);
     }


More information about the Digitalmars-d-learn mailing list