It is derived frombinary_oarchive_implNOTbinary_oarchive
As described in the comments in
binary_oarchive.hpp.
binary_oarchive really a shorthand name for
binary_oarchive_impl<binary_oarchive>. So we should derive
from binary_oarchive_impl<portable_binary_oarchive> rather
than binary_oarchive.

Note theportable_binary_oarchivebetween the <>
This is required so that base classes can downcast their this pointer
to the most derived class. This is referred to as Curiously Recurring
Template Pattern (CRTP) [11].
It is used to implement static polymorphism.

Base classes need to be explicitly given access to the derived class.
This can be done by making members public or by including friend declarations for
the base classes.

Base class functions will usually need to be explicitly invoked
We commonly overload the function name save for saving primitives.
This is very convenient. Usage of a function name in a derived class
"hides" similarly named functions of the base class. That is,
function name overloading doesn't automatically
include base classes. To address this, we can use:

for just this purpose. Failure to include required template definitions
will result in undefined symbol errors when the program is linked.

Without alteration, this class cannot be further derived from
Base classes using CRTP must be templates with a parameter corresponding to
the most derived class. As presented here, this class doesn't qualify, so
it cannot be used as a base class. In order to derive further from this class,
it would have to be reorganized along the lines of the original binary_oarchive.
Specifically, it would look something like:

The second example
demo_fast_archive.cpp.
is similar to the first one. The difference is that it intercepts the serialization before
the default serialization is invoked. In this case we want to replace the default
serialization of C arrays of integers with a faster one. The default version
will invoke serialization of each element of the array. If its an array of
integers, and we're not concerned with the archive being portable to another platform
we can just save/load the whole array as a binary string of bytes. This should
be faster than the default element by element method.

The same considerations that applied when overriding the the save/load of primitives
above apply here, and the code is very similar.