[odb-users] reuse inheritance with templated base class
Boris Kolpackov
boris at codesynthesis.com
Tue Jul 29 14:15:27 EDT 2014
Hi Marcel,
Marcel Nehring <mne at qosmotec.com> writes:
> #pragma db object optimistic
> template <class T>
> class Base
ODB does not support persistent class templates. The persistent data
(m_id and m_version in your case) rarely depends on the template
argument (it doesn't in your case) so what you can do is split your
base into two classes:
#pragma db object optimistic
class BaseData
{
#pragma db id auto
long long m_id;
#pragma db version
const unsigned long long m_version;
};
// Note: not persistent object
template <class T>
class Base
{
...
};
#pragma db object
class Derived : public Base<Derived>, public BaseData
{
...
};
Boris
More information about the odb-users
mailing list