cast ref pointer

Adam D. Ruppe destructionator at gmail.com
Thu Jan 18 16:44:52 UTC 2018


On Thursday, 18 January 2018 at 16:26:54 UTC, Luís Marques wrote:
> The actual function bar also receives by ref its pointer.

you might be better off receiving a pointer-to-pointer instead of 
ref. Then it will be encoded in the type and thus you can cast 
outer layers too and use intermediate more easily if you need.

void foo(void** f) {
    bar(cast(int**) f);
}

int* a;
foo(&a);


More information about the Digitalmars-d-learn mailing list