Re: Pass function (not alias) to template and/or delegate-ize a template argument

2018-06-11 Thread ag0aep6g via Digitalmars-d-learn
On 06/11/2018 08:46 AM, cc wrote: struct MYUDA {} class Foo { @(MYUDA) int bar(int x) { return x*2; } } auto foo = new Foo(); [...] I did figure out I can do it with mixins like so: void MCALL(string func, V...)(V args) { mixin(`assert(hasUDA!(`~func~`, MYUDA));`); // Ok

Pass function (not alias) to template and/or delegate-ize a template argument

2018-06-11 Thread cc via Digitalmars-d-learn
Is it possible to pass a class member function as a template argument in such a way that it can 1. be called during runtime, and 2. still retrieve the UDAs of the function itself? For example, given this setup: struct MYUDA {} class Foo { @(MYUDA) int bar(int x) { return x*2; } }