[odb-users] raw pointer to application's global array

Boris Kolpackov boris at codesynthesis.com
Thu May 29 09:40:05 EDT 2014


MM <finjulhich at gmail.com> writes:

> Ok, but can I have a virtual member integer that stands for auto generated
> id? If not, I'll just add a integer (std::uintx_t) as a member of that
> struct, and use that as the auto id.

ODB-supported auto-id can only be a single data member of an integer
type. It cannot be a member of a struct. It can be a virtual data

#pragma db member(my_id) virtual(unsigned long) id

> also, in the virt member pragma
> #pragma db member(foo) virtual(std::string) get(*this.foo_) set(set_foo)
> My foo_ is actually public.
> Can the setter be declared in the non intrusive header for the pragmas, as
> a non member function?

Yes, but then you will need to spell out the call expression explicitly:

class object
  #pragma db member(foo) virtual(std::string) set(set_foo (this, (?)))

void set_foo (object& o, const std::string foo)

For more detail see the describtion of the accessor and modifier
expressions in the ODB manual (Section 14.4.5, "get/set/access").


More information about the odb-users mailing list