[odb-users] Curiously recurring template and odb

Boris Kolpackov boris at codesynthesis.com
Fri Mar 13 09:13:04 EDT 2015


Hi Alexandre,

Alexandre Pretyman <alexandre.pretyman at gmail.com> writes:

> Since my events (unfortunately) inherit from base class event, I test their
> type to see if it what is expected by the transition, casting them to their
> derived type, and use the CRTP to cast the transition to its derived type,
> calling a method with the derived event.

Ok, you lost me here.

In any case, check Section 15.2, "Persistent Class Template
Instantiations" in the ODB manual.

Essentially, you cannot store C++ class templates in the database but
you can class templates instantiations. Once the dust settles after
all your CRTP exploits, you have a set of template instantiations. So
all you have to do is map all of them with ODB pragmas to persistent
classes. Admittedly, CRTP may make untangling all this challenging,
but it is definitely should be possible.

Boris



More information about the odb-users mailing list