Some strange parameter deduction problems in opOpAssign and opBinary

Ivan Agafonov armadil at yandex.ru
Sun Sep 2 08:12:35 PDT 2012


On Sunday, 2 September 2012 at 07:44:12 UTC, Philippe Sigaud 
wrote:
>> Problem solved:
>>
>> alias Vec!(T, size) V;
>>
>> // This works fine
>> ref V opOpAssign(string op)(V rhs)
>>
>> {
>>         mixin("array[] "~op~"= rhs.array[];");
>>                 return this;
>> }
>
> Inside a template, you can refer to the current (local) 
> instantiation by
> its name only. Try using 'Vec' instead of V. Does this work?
>
> If you want to force the use of another instantiation, I 
> personally put a
> dot ('.') before the template: this is the 'global scope' 
> operator and the
> compiler will 'step out' of the current template.

Yeah! Thanks. No need to alias. Needed simple Vec instead of 
Vec!(T, size)


More information about the Digitalmars-d-learn mailing list