Thank you very much for your answers. The point I had mostly
misunderstood was alias template parameters, which make this
possible.
On Saturday, 6 January 2024 at 17:57:06 UTC, Paul Backus wrote:
On Friday, 5 January 2024 at 20:41:53 UTC, Noé Falzon wrote:
In fact, how can the template be instantiated at all in the
following example, where no functions can possibly be known at
compile time:
```
auto do_random_map(int dele
On Friday, 5 January 2024 at 20:41:53 UTC, Noé Falzon wrote:
In fact, how can the template be instantiated at all in the
following example, where no functions can possibly be known at
compile time:
```
auto do_random_map(int delegate(int)[] funcs, int[] values)
{
auto func = funcs.choi
On Fri, Jan 05, 2024 at 08:41:53PM +, Noé Falzon via Digitalmars-d-learn
wrote:
> On the subject of `map` taking the function as template parameter, I
> was surprised to see it could still be used with functions determined
> at runtime, even closures, etc. I am trying to understand the
> mecha
On the subject of `map` taking the function as template
parameter, I was surprised to see it could still be used with
functions determined at runtime, even closures, etc. I am trying
to understand the mechanism behind it.
The commented out line causes the error that `choice(funcs)`
cannot be