[odb-users] Avoid copying objects from odb::result
aongeeno at openmailbox.org
aongeeno at openmailbox.org
Wed Jun 14 03:23:41 EDT 2017
Good day! How I can avoid copying objects in this code?
PRAGMA_DB(object)
struct Category
{
Category() {}
PRAGMA_DB(member id)
CategoryID id = -1;
QString name;
private:
friend class odb::access;
};
/* ............................*/
std::unordered_map<int, std::unique_ptr<Category>> categories;
/* ............................*/
auto result(db_->query<Category>());
for (Category & c : r)
//categories[c.id] = std::make_unique(c); ???
More information about the odb-users
mailing list