[odb-users] Bidirectional Many-to-Many Relationship Problem

Boris Kolpackov boris at codesynthesis.com
Thu Feb 12 04:19:08 EST 2015


Hi Chen,

Chen Weiguang <CWeiguan at dso.org.sg> writes:

> error 2440: '<function-style-cast>' : cannot convert from 'X *' to
> 'std::weak_ptr<X>' No constructor could take the source type, or
> constructor overload resolution was ambiguous.

If you look at the line where this error points to, just above it
there is a nice comment that explains why you are getting this
error.

Also, in the first paragraph of Chapter 6, "Relationships", we read:

"Any supported smart pointer can be used in a data member as long as
it can be explicitly constructed from the canonical object pointer
(Section 3.3, "Object and View Pointers")."

So I suggest that you read about "canonical object pointer" in Section
3.3 and see if it will all make sense.

Boris



More information about the odb-users mailing list