Re: Function template as template parameter

2022-12-11 Thread Andrey Zherikov via Digitalmars-d-learn
On Sunday, 11 December 2022 at 16:24:30 UTC, Ali Çehreli wrote: On 12/11/22 05:54, Salih Dincer wrote: > On Sunday, 11 December 2022 at 09:43:34 UTC, Andrey Zherikov wrote: >> Note that callback parameter must be compile-time parameter as it >> represents a member of a type during introspection d

Re: Function template as template parameter

2022-12-11 Thread Ali Çehreli via Digitalmars-d-learn
On 12/11/22 05:54, Salih Dincer wrote: > On Sunday, 11 December 2022 at 09:43:34 UTC, Andrey Zherikov wrote: >> Note that callback parameter must be compile-time parameter as it >> represents a member of a type during introspection done by `foo`. > > I can't quite understand the question, this alr

Re: Function template as template parameter

2022-12-11 Thread Salih Dincer via Digitalmars-d-learn
On Sunday, 11 December 2022 at 09:43:34 UTC, Andrey Zherikov wrote: Note that callback parameter must be compile-time parameter as it represents a member of a type during introspection done by `foo`. I can't quite understand the question, this already works: ```d void foo(alias callback)() {

Function template as template parameter

2022-12-11 Thread Andrey Zherikov via Digitalmars-d-learn
I have this (very simplified) code: ```d void foo(alias callback)() { callback!5; } static void print(int i)() { writeln(i); } foo!print; ``` Is there a way to merge two last lines into one of a form like `foo!(...something...)`? Note that callback parameter must be compile-time parameter