[odb-users] Testing whether lazy_shared_ptr is null

Brian Coggins becoggins at hotmail.com
Tue Apr 23 08:58:57 EDT 2019

On Apr 22, 2019, at 12:17 PM, Boris Kolpackov <boris at codesynthesis.com> wrote:

> Also, just to add a point about weak pointers, to correctly test whether
> it is NULL you need to call it's lock() function, get the strong pointer,
> and then proceed as above.

Ah, my mistake!  This was the problem.  I have a number of lazy_shared_ptr and lazy_weak_ptr going in various directions in this schema, and the relationship I wanted to test was actually a lazy_weak_ptr.  I couldn’t figure out why it wouldn’t convert to bool, but it makes sense that it has to be locked first.


More information about the odb-users mailing list