[odb-users] Problem declaring templated class as composite value type

Boris Kolpackov boris at codesynthesis.com
Sun Jan 8 10:39:08 EST 2012


Hi Andor,

Boris Kolpackov <boris at codesynthesis.com> writes:

> Andor Pathó <andor.patho at dlubal.cz> writes:
> 
> > If I try using #pragma db value(vector3d), where vector3d is a typedef  
> > for a template specialization of the templated vector type, the odb  
> > compiler crashes:
> >
> > [...]
> >
> > I am not sure whether this is a bug, or mapping template classes is not  
> > supported in ODB at all, as I have found no mention of it in the  
> > documentation.
> 
> While we do not support this at the moment, I checked the code and I
> don't see any reason why we shouldn't support this case. I will try
> to implement this later today and will get back to you.

Ok, I have implemented this and now we can define composite value types
as C++ class template instantiations:

typedef std::pair<int, std::string> int_str_pair;
#pragma db value(int_str_pair)

#pragma db object
class object
{
  ...

  int_str_pair pair_;
};

I can build you a 1.7.0 ODB compiler binary with this support if you
would like to give it a try. Just let me know which platform(s) you
need.

Boris



More information about the odb-users mailing list