Am I missing with ref in this code?

Suliman evermind at live.ru
Thu Jan 24 16:04:06 UTC 2019


> It's because runWorkerTask internally passes its arguments 
> along to the function by value:
>
> https://github.com/vibe-d/vibe.d/blob/master/core/vibe/core/core.d#L364
>
> The workaround is to pass a pointer instead:
>
>     void getServiceStatus(MyUrl* url) {
>         // ...
>     }
>
>     // ...
>
>     runWorkerTask(&getServiceStatus, &url);


void getServiceStatus(MyUrl* url)
{
...
}


  Error: static assert:  "Cannot convert arguments '(MyUrl)' to 
function arguments '(MyUrl*)'."


More information about the Digitalmars-d-learn mailing list