[odb-users] 2 virtual members mapping to 1 transient member

MM finjulhich at gmail.com
Thu Mar 19 10:27:08 EDT 2015


struct Base;  /// c++ abstract and odb abstract

struct A : public Base {...};
struct B : public Base {...};
struct C : public Base {...};

struct S : public Base {
  const Base* linked;  /// can be either A B or C
};

#pragma db object(S) definition
#pragma db member(igindex_dfb::linked) transient
#pragma db member(igindex_dfb::linkedtype) virtual(std::string) get() set()
#pragma db member(igindex_dfb::linkedid) virtual(std::uint32_t) get() set()

2 columns from the database, linkedtype and linkedid.
the linkedtype is either "A" or "B" or "C"
the linkedid identifies which instance of A is linked to by S.

How can I make it atomic to have    'linked'   map to both 'linkedtype' and
'linkedid' at the same time?


More information about the odb-users mailing list