[Issue 12872] Feature request: Allow ref in arguments at the callsite

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 16 13:24:20 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=12872

apham <apz28 at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apz28 at hotmail.com

--- Comment #5 from apham <apz28 at hotmail.com> ---
Actual benefit is for variadic arguments function call. For this case, it
allows callside to specify how argument to be passed. This also allow to create
generic template to define delegate/event 

void print(A...)(A a)

or

struct DelegateList(Args...)
{
    alias DelegateHandler = void delegate(Args args);

    DelegateHandler[] items;

    void opCall(Args args)
    {
        foreach (i; items)
            i(args);
    }
}

--


More information about the Digitalmars-d-bugs mailing list