Re: alias to struct method

2017-12-22 Thread Mengu via Digitalmars-d-learn
On Friday, 22 December 2017 at 17:53:34 UTC, Marc wrote: How can I create a alias to a struct method? struct S { string doSomething(int n) { return ""; } } I'd like to do something like this (imaginary code): alias doSomething = S.doSomething; then call it by doSomething(3) I got the foll

Re: alias to struct method

2017-12-22 Thread Ali Çehreli via Digitalmars-d-learn
On 12/22/2017 09:53 AM, Marc wrote: > How can I create a alias to a struct method? > >> struct S { >> string doSomething(int n) { return ""; } >> } > > I'd like to do something like this (imaginary code): > > alias doSomething = S.doSomething; > > then call it by doSomething(3) That can't work b

alias to struct method

2017-12-22 Thread Marc via Digitalmars-d-learn
How can I create a alias to a struct method? struct S { string doSomething(int n) { return ""; } } I'd like to do something like this (imaginary code): alias doSomething = S.doSomething; then call it by doSomething(3) I got the following error from this code: Error: need 'this' for 'gen'