Re: Problem with templated alias as delegate parameter type

2021-01-12 Thread cc via Digitalmars-d-learn
On Tuesday, 12 January 2021 at 21:32:14 UTC, Ali Çehreli wrote: On 1/12/21 12:58 PM, cc wrote: > void send(T query, void delegate(T.RESPONSE) callback) { That wants a delegate that takes a T.RESPONSE (PingResponse in this case). However, the following lambda is in fact a template: >

Re: Problem with templated alias as delegate parameter type

2021-01-12 Thread Ali Çehreli via Digitalmars-d-learn
On 1/12/21 12:58 PM, cc wrote: > void send(T query, void delegate(T.RESPONSE) callback) { That wants a delegate that takes a T.RESPONSE (PingResponse in this case). However, the following lambda is in fact a template: > send(PingQuery("helo"), (resp) { You specify the type there an

Problem with templated alias as delegate parameter type

2021-01-12 Thread cc via Digitalmars-d-learn
Given the following program: struct PingQuery { string msg; } struct PingResponse { string msg; } template send(T) { void send(T query, void delegate(PingResponse) callback) { writefln("Sending: %s", query); if (callback) {