problem with template arguments deduction
Zhenya
zheny at list.ru
Fri Jun 1 05:47:16 PDT 2012
On Friday, 1 June 2012 at 12:38:11 UTC, Dmitry Olshansky wrote:
> On 01.06.2012 15:47, Zhenya wrote:
>> Error 3 Error: function expected before (), not
>> bind(&checker,2,1,4) of
>> type _error_ c:\users\zhenya\documents\visual studio
>> 2010\Projects\D\ConsoleApp1\ConsoleApp1\main.d 98
>>
>> Error 1 Error: template instance bind!([0,2]) bind!([0,2])
>> does not
>> match template declaration bind(D,V...)
>> c:\users\zhenya\documents\visual
>> studio 2010\Projects\D\ConsoleApp1\ConsoleApp1\main.d 81
>>
>> Error 2 Error: template instance main.bind!([1,0,3]).bind!(void
>> delegate(int _param_0, int _param_1, int _param_2, int
>> _param_3)
>> @system,int,int,int) error instantiating
>> c:\users\zhenya\documents\visual studio
>> 2010\Projects\D\ConsoleApp1\ConsoleApp1\main.d 98
>>
>>
>
> It may have some problem with matching this delegate hmmm.
> What if you try this:
>
> template Bind(alias indeces)
> if(is(typeof(indeces) : int[]))
> {
> auto bind(V...)(alias dg,V values)
> if(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
> assert(0);
> }
> }
> alias instead of delegate - it's just more powerful
> I relaxed constraints and static ifs ---> proper template
> constraints.
Error 1 basic type expected, not
alias c:\users\zhenya\documents\visual studio
2010\Projects\D\ConsoleApp1\ConsoleApp1\main.d 75
Похоже что alias не может быть
аргументом времени выполнения
More information about the Digitalmars-d-learn
mailing list