Templated static opCall in non-templated struct

Matthew Dudley pontifechs at gmail.com
Tue Feb 11 17:40:36 PST 2014


On Tuesday, 11 February 2014 at 19:15:25 UTC, Philippe Sigaud 
wrote:
> On Tue, Feb 11, 2014 at 1:05 AM, Namespace 
> <rswhite4 at googlemail.com> wrote:
>
>>>         static opCall(int i)(int j, int k)
>>>         {
>>>                 return Foo(i+j,i+k);
>>>         }
>
>>>         auto bob = Foo!(1)(2,3); //Error:
>
>> Welcome to my world ;)
>> http://forum.dlang.org/thread/hdocnxglxmfpacnpmouh@forum.dlang.org
>
> Did you try using a templated constructor?

Like this?

this(int i)(int j, int k)
{
     this.i = i + j;
     this.j = i + k;
}

Same error.


More information about the Digitalmars-d-learn mailing list