Problem with aliasing member function

Andrey saasecondbox at yandex.ru
Sun Aug 18 19:17:16 UTC 2019


Hello,
I can't compile this piece of code:
> struct Object
> {
>     void run(wstring ending, uint index)(int number)
>     {
> 
>     }
> }
> 
> void tester(alias callback, T)(int number, T object = null)
> {
>     static if(is(T == typeof(null))) alias handler = callback;
>     else auto handler(wstring ending, uint index) = 
> object.callback!(ending, index);
>         	handler!("rfv", 5)(word);
> }
> 
> void main()
> {
>     Object obj;
>     tester!(Object.run)(10, &obj);
> }

Here in tester I want to alias a template method and call it on 
object if this object isn't null. But I don't understand how to 
do it.
How to solve the problem?


More information about the Digitalmars-d-learn mailing list