Some time ago I decided to write in D something like boost :: bind.But I encountered a problem that the compiler can not deduce the template function. Here are a significant part of the code:

template Combination(alias indeces,U...)
{
//      static if(is(typeof(indeces) : uint[]))
//      {
                static if(indeces.length > 1)
alias TypeTuple!(U[indeces[0]],Combination!(indeces[1..$],U)) Combination;
                else static if(indeces.length == 1)
                        alias U[indeces[0]] Combination;
//      }
}

template bind(alias indeces)
{
//      static if(is(typeof(indeces) : uint[]))
//      {
auto bind(R,U...)(R delegate(U) dg,Combination!(indeces,U) values)
                {
/*                      static if(indeces.length > 1)
return bind!(update!(indeces,indeces[0]))(Curry!(indeces[0])(dg,values[0]),values[1..$]);
                        else static if(indeces.length == 1)
                                return Curry!(indeces[0])(dg,values[0]);
*/              }
//      }
}

void main()
{
        void xyz(int x,int y,int z)
        {
                writeln("x = ",x," y = ",y," z = ",z);
        }
//      auto g = Curry!1(&xyz,cast(int)(1.1));
//      g(2,3);
        alias Combination!([0,1],int,int,int) Arg;
        Arg a;
        bind!([0,1])(&xyz,a);
        readln();
}

Please, explain to me what is wrong with this code

Reply via email to