Thread overview |
---|
August 28, 2020 How to define delegate what returns ref? | ||||
---|---|---|---|---|
| ||||
Hello all! syntax ref int delegate() foo0; or ref(int) delegate() foo1; or int delegate() ref foo2; are not valid. if I try alias alias refint = ref int; refint delegate() foo3; foo3 have type `int delegate()` (without `ref`) and it can't store delegate from object method that have `int delegate() ref` (that can be printed if we use `typeof(&someobject.method).stringof`) I found only one ugly way to do this interface Foo { ref int func(); } typeof(&Foo.init.func) foo4; How to do this more clearly? |
August 28, 2020 Re: How to define delegate what returns ref? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Oleg B | On Friday, 28 August 2020 at 11:46:15 UTC, Oleg B wrote:
> How to do this more clearly?
alias Dg = ref int delegate();
Dg foo;
|
August 28, 2020 Re: How to define delegate what returns ref? | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Friday, 28 August 2020 at 11:50:35 UTC, kinke wrote:
> On Friday, 28 August 2020 at 11:46:15 UTC, Oleg B wrote:
>> How to do this more clearly?
>
> alias Dg = ref int delegate();
> Dg foo;
Thanks!
|
Copyright © 1999-2021 by the D Language Foundation