[odb-users] sqlite, one to many relationship, std::map, std::weak_ptr

Daniel James danielpeterjames at gmail.com
Thu Jan 17 10:29:17 EST 2013


On 17 January 2013 15:20, Boris Kolpackov <boris at codesynthesis.com> wrote:

> Hi Daniel,
>
> 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,
> "inverse":
>
> "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."
>

Thanks for the answer. What's the rationale for not enabling std::map but
enabling std::set and 'ordered' containers?

Boris
>


More information about the odb-users mailing list