[odb-users] Pimpl + Relations

Boris Kolpackov boris at codesynthesis.com
Tue Oct 2 10:24:25 EDT 2012

Hi Uwe,

cetoni GmbH - Uwe Kindler <uwe.kindler at cetoni.de> writes:

> typedef boost::shared_ptr<CLens> LensPtr;
> #pragma db member(Lens1) virtual(LensPtr) get(lens) set(setLens)

This should work in theory. In practice what happens is the ODB
compiler checks for a default constructor in LensPtr (which is
needed because a by-value modifier is used). It doesn't find it
even though boost::shared_ptr is default-constructible because 
shared_ptr<CLens> is not fully instantiated.

I've fixed this by making sure that virtual data member types are
fully instantiated before checking for the default ctor. Can you
try a new revision of the 2.1.1 bugfix and see if it works for


Also, you can simplify the above pragma if you use 'lens' as the
virtual member name. This way the ODB compiler should find the 
accessor and modifier functions automatically:

#pragma db member(lens) virtual(LensPtr)


More information about the odb-users mailing list