|
Boost : |
From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2002-11-22 16:28:34
> > 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk