[odb-users] How to define odb::section for a member defined in base class

Vladimir Yelnikov vladimir.yelnikov at gmail.com
Fri Jan 12 12:54:49 EST 2018

Hi All,

I would like to declare a derived class demo2 with section tied with
base member data but ODB compiler can't generate proper code with
error pointing last pragma:

error: ')' expected at the end of db pragma section

Everything works if section and member defined in the same class.

struct demo


  std::deque<float> data;


struct demo2 : public demo


  int id;

  odb::section dataSection;


#pragma db object(demo) definition abstract

#pragma db object(demo2)

#pragma db member(demo2::id) id

#pragma db member(demo2::dataSection) load(lazy)

#pragma db member(demo2::data) type("BLOB")  section(demo2::dataSection)

Is it possible to make things work?

Best Wishes,
Vladimir Yelnikov

More information about the odb-users mailing list