[odb-users] Combining ODB with CXX Tree
Boris Kolpackov
boris at codesynthesis.com
Mon Dec 11 11:11:14 EST 2017
Jeroen N. Witmond <jnw at xs4all.nl> writes:
> <complexType name="bicycle">
> <sequence>
> <element name="id" type="unsignedInt"/>
> <element name="name" type="NCName" />
> </sequence>
> </complexType>
>
> [...]
>
> namespace test
> {
> #pragma db object(bicycle)
> #pragma db member(bicycle::id_) id get(id()) set(id(?))
> #pragma db member(bicycle::name_) get(name()) set(name(?))
> }
>
> [...]
>
> ::xsd::cxx::tree::one< id_type > id_();
This declares a function, its doesn't call the default constructor.
xsd::cxx::tree::one<> is not default-constructible.
The way you can work around it (you could make one<> an ODB wrapper
if you wanted to do it "properly") is by using virtual data members.
Something along these lines:
#pragma db object(bicycle) transient
#pragma db member(bicycle::id) virtual(bicycle::id_type) id get(id()) set(id(?))
Boris
More information about the odb-users
mailing list