On Wednesday, 19 September 2012 at 19:24:34 UTC, Namespace wrote:
Result:
http://dpaste.dzfl.pl/24988d8f

I like it, but how can something placed on the stack be reference counted? The "chunk" is also placed on the stack, so it doesn't really make sense to me: When the object goes out of scope, the chunk goes, regardless of ref count. I think you should ditch the whole ref count thing.

You'll also have to be aware of the dangers of putting a class instance on the stack:

main()
{
    A a;
    {
        stacked_obj!A so;
        so.gen;
        a = so.get;
    }
    a.print(); //<-- undefined, with or without reference count
}

IE: Big red comment you should NEVER extract an instance from the stack.

Reply via email to