[odb-users] Problem with many-to-many example
Boris Kolpackov
boris at codesynthesis.com
Wed Jul 13 06:21:54 EDT 2016
Hi Tom,
Tom Stoffer <tomstoffer at gmail.com> writes:
> The one thing that does get it to compile is if I add:
> pointer(std::shared_ptr) To the pragma for employee, but I’m not sure why,
> and actually I don’t think this will work for my situation as the class
> which will be needed to have a many-to-many also inheriting from an abstract
> polymorphism. As soon as I introduce this change, I start getting other
> compiler errors to do with shared_ptr not being supported.
If you want to use bi-directional relationships like these then you will
need the shared_ptr/weak_ptr semantics and you will have to make shared_ptr
the object pointer for all the objects involved. I would just make all the
objects consistently use shared_ptr, it should get rid of any compile errors.
See Section 3.3, "Object and View Pointers" in the manual for details.
Boris
More information about the odb-users
mailing list