$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Matthias Troyer (troyer_at_[hidden])
Date: 2005-10-10 06:33:36
On Oct 10, 2005, at 7:21 AM, troy d. straszheim wrote:
> On Sun, Oct 09, 2005 at 02:15:44PM -0700, Robert Ramey wrote:
>
>> With this approach you would make one fast_oarchive adaptor class
>> and one small and trivial *.hpp file for each archive it is  
>> adapted to.
>>
>
>
> And I've done this for a few archive types.  Works fine.  The
> portable_binary_archive example, does the same thing, except it does
> so for save(), like this:
>
>
> class portable_binary_oarchive :
>     public  
> boost::archive::binary_oarchive_impl<portable_binary_oarchive>
> {
>     typedef portable_binary_oarchive derived_t;
>     typedef  
> boost::archive::binary_oarchive_impl<portable_binary_oarchive>
>       base_t;
>
>     // default fall through for any types not specified here
>     template<class T>
>     void save(const T & t){
>         base_t::save(t);
>     }
>     void save(const unsigned int t){
>         save_impl(t);
>     }
> };
>
>
> Which I've also used.  AFAICT, I could do what I've needed to do so
> far either way.  What's the difference?  Apologies in advance if I've
> missed something in the docs.
For a portable binary archive this solution is perfect. For fast  
array serialization a similar approach has problems, as I outlined  
under point 3 and 4 in my response to Robert Ramey: you need to  
specifically overload _in the archive_ for all classes that want to  
make use of fast array serialization, thus introducing a tight  
coupling between archive and class to be serialized, as well as  
making it hard to extend.
Matthias