Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2003-09-27 20:50:12

At 02:57 2003-09-28, Howard Hinnant wrote:
>>In that case, couldn't you allocate the scoped_lock dynamically and move it
>>when copying?
>I was really hoping to avoid heap allocation on this one.

Even if it's pooled? Something like this:

locked_ptr<X> singleton()
    static X x;
    static locker_pool p;
    return locked_ptr<X>(&x, p.allocate());

(sample implementation attached)

Daniel Wallin

Boost list run by bdawes at, gregod at, cpdaniel at, john at