[odb-users] Can I use relationship and polymorphic at the same time?

Boris Kolpackov boris at codesynthesis.com
Mon Nov 12 08:31:41 EST 2018

Jerry <kexuetutu at sina.com> writes:

> std::map<unsigned long, std::shared_ptr<B>> m_CheckSectionResultTable;
> When I compile the File2 with ODB, it tells me this
> ElementDesignResult.h:40:68: error: unable to map C++ type '::std::map< long
> unsigned int, ::std::shared_ptr< ::SectionDesignResultBase > >::mapped_type'
> used in data member 'm_CheckSectionResultTable' to a SQLite database type

This is most likely caused by shared_ptr not being the object pointer
of B. See Section 3.3 "Object and View Pointers" for details.

> 2. I'm confuse with the "value" and "object" [...]
> 3. I'm confuse with the "abstract" useage [...]

These are explained in the manual. Make sure you read through Chapter 3,
"Working with Persistent Objects" in its entirety.

More information about the odb-users mailing list