[odb-users] Specializing wrapper_traits

Boris Kolpackov boris at codesynthesis.com
Thu Apr 28 09:53:13 EDT 2016


Hi Steve,

Hales, Steve <Steve.Hales at garmin.com> writes:

> A follow-up question: What is the purpose of null_handler and null_default
> in wrapper_traits?

odb::wrapper_traits is a general mechanism for any kinds of "wrappers" (i.e.,
objects that "hold" other objects). And some of them don't have the NULL
pointer/value semantics. std::reference_wrapper is a good example of one.

So null_handler indicates whether the wrapper has a notion of NULL/absent
value. If it is true, then null_default indicates whether a member of
such a wrapper type should be treated as NULL-able by default (i.e., you
don't need to specify '#pragma db null' for it).

Boris



More information about the odb-users mailing list