[odb-users] How to cache the queried object pointer?
Boris Kolpackov
boris at codesynthesis.com
Fri Nov 1 11:06:39 EDT 2019
Justin Huang <yohuang at nvidia.com> writes:
> typedef odb::result<Module> result;
> result all_modules (db->query<Module> ());
>
> int count = 0;
> for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) {
> auto ptr = i.operator->();
> modules.push_back(ptr);
You should use result::iterator::load() (i.load()) to load an object from
a query result. See Section 4.4, "Query Result" for details.
More information about the odb-users
mailing list