Date: Mon, 18 Nov 2002 08:19:28 +0100
From: Matthias Troyer
>> overriding the very general template definiations above for this 
>> special case would result in
>>
>> template<class T>
>> inline boost::basic_iarchive & operator>>(boost::basic_iarchive &ar, 
>> double & x[]){
>>      ar.read_binary(x, sizeof(x));
>> }
>> template<class T>
>> inline boost::basic_oarchive & operator<<(boost::basic_oarchive &ar, 
>> const T &t){
>>      ar.write_binary(x, sizeof(x));
>> }
>>
>> this skips the whole serialization system and just blasts the data 
>> in/out

>No, that is not what I meant. I want to optimize reading/writing of a 
>std::vector<double> for SOME types of archives only for which an 
>optimized save/load is possible. That is e.g. not for a text or XML 
>archive but only for binary archives. In your proposal this could only 
>be done by a run time type check, a dynamic_cast to a derived optimized 
>class and then calling a member function of that derived class. This is 
>much more naturally done through additional virtual function for 
>writing arrays of primitive data types.

suppose you had a header:

matias_superfast_binary_archive.hpp

that contained:

#include <boost/serialization/archive.hpp>

template<class T>
inline boost::basic_iarchive & operator>>(boost::basic_iarchive &ar, 
double & x[]){
        ar.read_binary(x, sizeof(x));
}
template<class T>
inline boost::basic_oarchive & operator<<(boost::basic_oarchive &ar, 
const T &t){
        ar.write_binary(x, sizeof(x));
}

endof file

wouldn't that do the job? the onlything is that you couldn't include two
different kinds of archives in the same code module.

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

Reply via email to