[odb-users] Problem with session cache and weak_ptr
Boris Kolpackov
boris at codesynthesis.com
Thu Jun 2 08:31:34 EDT 2016
Hi Marcel,
Marcel Nehring <mne at qosmotec.com> writes:
> sorry for so many questions about this topic but it is causing a lot
> of trouble and confusion here.
No problem, lazy weak pointers are tricky.
> If the object a lazy_weak_ptr points to expires, is the state of the
> pointer still loaded or will it change to unloaded?
That depends on whether the pointer pointed to the transient or
persistent objects.
> I.e. if I have a valid pointer to a persistent object, and the pointer
> expires, will loaded() return true (so that it become effectively a NULL
> pointer to a transient object) or will it return false (so that it
> effectively becomes an unloaded pointer to a persistent object)?
It will return false. Here is the "truth table" from the lazy_weak_ptr
header:
// expired() loaded()
//
// true true expired pointer to transient object
// false true valid pointer to persistent object
// true false expired pointer to persistent object
// false false valid pointer to transient object
//
Boris
More information about the odb-users
mailing list