Convert delegate or function type to other.

Rufus Smith via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 18 12:19:34 PDT 2016


On Monday, 18 July 2016 at 18:51:29 UTC, Jacob Carlborg wrote:
> On 2016-07-18 20:49, Rufus Smith wrote:
>> Suppose I have the following: alias func = void function(int);
>>
>> Is there a way to convert it automatically to something the 
>> same type
>> except of delegate: alias del = toDel(func) = void 
>> delegate(int);?
>
> https://dlang.org/phobos/std_functional.html#toDelegate

No, that converts an actual function. I need to create a new 
alias from the old one.

I'd also like to be able to create a delegate with a different 
context pointer.


More information about the Digitalmars-d-learn mailing list