[odb-users] sqlite, one to many relationship, std::map,
boris at codesynthesis.com
Thu Jan 17 10:20:17 EST 2013
Daniel James <danielpeterjames at gmail.com> writes:
> #pragma db inverse(parent)
> std::map<std::string, std::weak_ptr<Child>> children;
You cannot use a map container for an inverse side of a relationship.
While the ODB compiler does not yet diagnose this situation (I've
added a TODO item), the ODB manual mentions this in Section 12.4.14,
"An inverse member does not have a corresponding column or, in case
of a container, table in the resulting database schema. Instead,
the column or table from the referenced object is used to retrieve
the relationship information. Only ordered and set containers can
be used for inverse members. If an inverse member is of an ordered
container type, it is automatically marked as unordered."
More information about the odb-users