function(pointer) as template argument, explicit template instantiation

kdevel kdevel at vogtner.de
Fri Dec 31 11:22:33 UTC 2021


On Friday, 31 December 2021 at 03:02:08 UTC, Tejas wrote:
[...]
> Is it okay to use template parameter instead of **template 
> value** parameter?
> ```d
> class R {
> }
>
> void foo (R r)
> {
> }
>
> void lyr (fp_type, R) (fp_type fp, R r)
> {
> }
>
> pragma (msg, typeof (&foo));
> R r;
> void main(){
>     auto foo_ptr = &foo;
>     lyr(foo_ptr, r);
> }
> ```

No, the type should be the same. I want to register lyr!(&foo) 
like this:

```
    fn [string] reg = [
       "foo": &foo,
       "lfoo": &lyr!(&foo)
    ];
```


More information about the Digitalmars-d-learn mailing list