On 08/09/2013 03:17 AM, JR wrote:

> On Thursday, 8 August 2013 at 21:16:36 UTC, David Nadlinger wrote:

>> when taking a pointer to stack data
>> (which is un-@safe), you have to take care not to escape it from the
>> scope.
>
> Can I manually store it on the heap and let the garbage collector keep
> it safe?

How about passing by-value? The following seems to work. (I used v2.064-devel-4203c06 but I don't know whether it is different on older compilers.)

// Receives by value:

        mixin MessageReaction.Print!(IrcEvent) immEvtPtr;

// Sends by value:

        IrcEvent e = fakeParser();
        p.send(e);

Ali

Reply via email to