[odb-users] custom relationship containers?

Boris Kolpackov boris at codesynthesis.com
Wed Sep 23 12:05:05 EDT 2015


Hi Christian,

Christian Sell <christian at gsvitec.com> writes:

> after having successfully introduced my own custom container class by
> implementing the appropriate value_trais template, I would now like to
> also use this container in relationships (i.e. the container holds
> shared_ptrs to a mapped class).

The containers and relationships features are orthogonal, you should
be able to use a container to store pointers to objects without doing
anything special.


> However, I am getting the meanwhile well-known error
>  
> error: unable to map C++ type '::FlexisBase::SharedPtrVectorProperty<
> ::flexis_data::Recording >' used in data member 'recordings' to a SQLite
> database type

Well, this looks more like a specialized container that implicitly
stores its elements as shared_ptr's. But I think you should still
be able to use it with ODB. Just make sure that value_type in the
container_traits specialization is shared_ptr<T>, not just T.

Boris



More information about the odb-users mailing list