In-Reply-To: <[EMAIL PROTECTED]>
On Tue, 19 Nov 2002 08:09:13 +0100 Matthias Troyer 
([EMAIL PROTECTED]) wrote:
> 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?

I am inclined to say it is, because I generally favour giving the archive 
more information about what is going on. And efficiency matters, 
especially for such a fundamental library as serialisation. It does not 
lead to more work for serialisation users or for the archive implementers. 
Still, it is a lot of new functions, and once added they can never be 
taken away. It may be better to leave them out now, and add them in 12 
months time, when we have had more experience with the library and its 
cost.

Incidently, an alternative would be to add the new virtual functions but 
remove the current ones, replacing them with non-virtual, inline versions 
which just use a count of 1, eg:

    basic_oarchive &operator>>( basic_oarchive &ar, int x ) {
        ar.save( &x, &x+1 );
    }

This makes some overhead for the single-int case. I have no idea whether 
the cost is worth the benefit in practice. 

-- Dave Harris

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to