Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2002-11-23 17:00:26

Date: Fri, 22 Nov 2002 16:28:34 -0500
From: "Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]>

> > > The only solution which comes to my mind is additional virtual
> > > functions for writing blocks of primitive types, which default to
> > > just calling the operator<< (>>) n times, but can be overridden
> > > by optimized functions for those archive types where optimized
> > > writes (load) are possible. Nothing else would need to be changed.
> > > What is objectionable in that approach?
> >
> > Well, it is a lot of new virtual functions - one per type,
> > almost doubling
> > the size of the archive interface. Is it worth it?

> No need for extra virtual functions. Using metaprogramming machinery you
> could easily construct classes that either have

> virtual void foo( int ) = 0;

> or

> void foo( int ) {...}

> Depends on template parameter.

> Gennadiy.

Could you please expand upon this? If serialization of fundamental type is invoked
through a base class member virtual functions are suggesting that this
base class be built differently on a regular basis? Wouldn't this preclude
leaving serialization code in a precompiled library? Even if generated automatically
it would still be a lot of virtual functions and double the size of the iterface.

What am I missing here?

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at