[odb-users] Re:Problem with object loading view

Andrew Cunningham odb at a-cunningham.com
Tue Mar 22 13:13:08 EDT 2016


Boris,

Every C++ OODB I am familiar with uses that "pattern" where an object is
loaded automatically by the use of the -> or (*) operators. For example,
Versant, Objectivity. I think what Marcel was saying was that having to
manually manage the load'ing of lazy_ptrs is fine for simple examples, but
for a complex C++ object model it just becomes too much of a burden. Using
-> to load means you really have no idea when the object is loaded, and
that's a good thing!

I could contribute my work, but I created a specialization of my own
intrusive reference counted shared pointer type - very specific to my use
case.

 Andrew

On Tue, Mar 22, 2016 at 9:01 AM, Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Hi Andrew, Marcel,
>
> Andrew Cunningham <odb at a-cunningham.com> writes:
>
> > Another approach you can use is to derive/implement a new type of
> lazy_ptr
> > that automatically loads the object (if needed) when you use the operator
> > -> or operator * on the lazy_ptr.
>
> Yes, not a bad option, if you are always in a transaction. Will take "I
> don't understand when and in which order my objects are loaded" to a whole
> new level ;-).
>
> Boris
>


More information about the odb-users mailing list