Re: Member function passed through template alias only requiring `this` in certain conditions?

2018-07-19 Thread Timoses via Digitalmars-d-learn
On Thursday, 19 July 2018 at 22:16:22 UTC, Ali Çehreli wrote: On 07/19/2018 08:12 AM, Emma wrote: > [...] > If I try to compile it, dmd complains, which I guess makes sense: > > --- > Error: need this for bar of type void() > Error: need this for baz of type void() > --- > > [...] I think it's

Re: Member function passed through template alias only requiring `this` in certain conditions?

2018-07-19 Thread Ali Çehreli via Digitalmars-d-learn
On 07/19/2018 08:12 AM, Emma wrote: > void test(alias fn1, alias fn2)() > { > fn1(); > fn2(); > } > > struct Foo > { > void foo() > { > test!(bar, baz); > } > > void bar() > {} > > void baz() > {} > } > --- > > If I try to compile it, dmd

Member function passed through template alias only requiring `this` in certain conditions?

2018-07-19 Thread Emma via Digitalmars-d-learn
Hello, I’ve got this piece of code: --- import std.stdio; void test(alias fn1, alias fn2)() { fn1(); fn2(); } struct Foo { void foo() { test!(bar, baz); } void bar() {} void baz() {} } --- If I try to compile it, dmd complains, which I guess