[odb-users] Create New Object

Boris Kolpackov boris at codesynthesis.com
Mon Jun 24 06:47:57 EDT 2013


Hi Tarik,

Tarik BENZ <tenchu.tarik at hotmail.fr> writes:

> class MyClass
> {
>      std::shared_ptr<MyOtherClass> foo;
> }
> 
> To create a new "MyClass" object, do I need to retrieve the data
> into "MyOtherClass" from the database then affect this object to "foo"
> or I can just use the "ID" of the "MyOtherClass"?

Lazy pointers allow you to create "unloaded" pointers with just the
object id. See Section 6.4, "Lazy Pointers" in the ODB manual, 
specifically, the example at the end of this section.

Boris



More information about the odb-users mailing list