Boost logo

Boost Users :

Subject: Re: [Boost-users] [SmartPtr] local_weak_ptr?
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-12-10 22:09:54


On 9/12/2017 04:19, Rob Conde wrote:
> How are boost::local_shared_ptr and boost::weak_ptr intended to be used
> together? I expected a local_weak_ptr, but it's not there so I'm
> wondering how you would (correctly) use local_shared_ptr and weak_ptr,
> or if you need local_weak_ptr and this is just still on the TODO list?

You can construct a shared_ptr from a local_shared_ptr and then
construct a weak_ptr from that.

Since local_shared_ptr isn't threadsafe, I *think* the intended use is
to keep shared_ptr/weak_ptr in data structures that might be shared
between threads, and copy to local_shared_ptr instances for purely
thread-local data structures, in that order. But that's just an
inference; I don't have any direct knowledge of the motivation.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net