problem with template arguments deduction
    Dmitry Olshansky 
    dmitry.olsh at gmail.com
       
    Sat Jun  2 00:29:14 PDT 2012
    
    
  
On 02.06.2012 11:23, Zhenya wrote:
> Дмитрий,не подскажите как я бы мог проверить не баг ли это?
Как я и говорил отписать что это баг. Дальше это дело экспертов по 
компилятору )
Вот например последние что ты отипсывал, вполне катит для bug-репорта:
(только сократи лишний "внешний" код)
this doesn't work:
template bind(alias indeces)
{
     static if(is(typeof(indeces) : int[]))
     {
         auto bind(D,V...)(D dg,V values)
         {
             static if(is(D d : R delegate(U), R, U...) &&
                       is(V == Combination!(indeces,ParameterTypeTuple!D)))
             {
                 static if(indeces.length > 1)
                     return
bind!(update!(indeces,indeces[0])[1..$]).bind(Curry!(indeces[0])(dg,values[0]),values[1..$]);
                 else static if(indeces.length == 1)
                     return Curry!(indeces[0])(dg,values[0]);
             }
         }
     }
}
while this works :
class Bind(alias indeces)
{
     static auto opCall(D,V...)(D dg,V values)
     {
         static if(is(D d : R delegate(U), R, U...) &&
                   is(V == Combination!(indeces,ParameterTypeTuple!D)))
         {
             static if(indeces.length > 1)
                 return 
Bind!(update!(indeces,indeces[0])[1..$])(Curry!(indeces[0])(dg,values[0]),values[1..$]);
             else
                 return Curry!(indeces[0])(dg,values[0]);
         }
     }
}
-- 
Dmitry Olshansky
    
    
More information about the Digitalmars-d-learn
mailing list