[odb-users] custom relationship containers?

Christian Sell christian at gsvitec.com
Wed Sep 23 12:22:59 EDT 2015


> 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.
 
correct, that's what it is. However, I now realize that SharedPtrVectorProperty
is a class (should have been an alias) for which I have no container_traits. I
have now switched to

VectorProperty<std::shared_ptr<Recording>>

where VectorProperty is known via container_traits, and Recording is mapped. As
a result, I get a load of compile errors from ODB generated code, starting with

error: 'index_type' in 'odb::access::object_traits_impl<flexis_data::Project,
(odb::database_id)1u>::recordings_traits::container_traits_type {aka class
odb::access::container_traits<FlexisBase::VectorProperty<std::shared_ptr<flexis_data::Recording>
> >}' does not name a type
       typedef container_traits_type::index_type index_type;
               ^
error: 'value_type' in 'odb::access::object_traits_impl<flexis_data::Project,
(odb::database_id)1u>::recordings_traits::container_traits_type {aka class
odb::access::container_traits<FlexisBase::VectorProperty<std::shared_ptr<flexis_data::Recording>
> >}' does not name a type
       typedef container_traits_type::value_type value_type;

 
any hints?
Christian



More information about the odb-users mailing list