[odb-users] value classes in views

Boris Kolpackov boris at codesynthesis.com
Fri Sep 19 03:22:52 EDT 2014


Hi Quentin,

Quentin Deldycke <quentindeldycke at gmail.com> writes:

> I need to create views using sub-objects. For instance, like this:
> 
> // a value object
> class B
> {
>    std::string test;
>    std::string test2;
> }
> 
> // My view
> class A
> {
>   B  object1;
>   B  object2;
> }

If B is a composite value type and is also used in the object on which
A is based, then this works out of the box. See Section 10.6, "Other
View Features and Limitations" for an example.

If some of the above doesn't hold, then it is still possible but will
require a bit more effort. See Section 14.4.13, "virtual" for a Swiss
army knife of packing/unpacking data members.

Boris



More information about the odb-users mailing list