[odb-users] constuct lazy_ptr with a given id

Boris Kolpackov boris at codesynthesis.com
Wed Jul 21 07:24:53 EDT 2021


icewill9999 at vip.qq.com writes:

> // Initialization with a persistent unloaded object.
> // template <class ID> lazy_ptr (database&, const ID&);
>
> I tried the code below,
> odb::database* db = /////;
> int aid = ////;
> lazy_shared_ptr<AreaInfo> aodbPtr(db, aid);
> But the compiler reports the error messages:
>
> [...]
> 
> Did I call this function a wrong way?

Yes, most likely. In particular, the constructor expects a reference
to database while you are passing a pointer. You need to start paying
attention instead of using this mailing list as an easy way (for you)
to fix your programming errors. In fact, I will no longer be answering
such queries from you.



More information about the odb-users mailing list