
Bizarre indeed - I'll look into it. Robert Ramey Jarl Lindrud wrote:
Hi,
RCF, a C++ middleware framework, supports using Boost Serialization for serialization of data structures. One of my user's reported a serialization bug to me, which I finally boiled down into the following piece of code:
#include <sstream> #include <string> #include <vector>
#include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/vector.hpp>
template<typename Archive> struct X { template<typename T> void operator<<(const T &t) { Archive &archive = (*(Archive *) NULL); archive << t; } };
void dummy() { typedef boost::archive::text_oarchive Archive; X<Archive> &x = * (X<Archive> *) NULL; std::vector<char> *pt = NULL;
// uncomment this line to cause the test to fail //x << pt; }
int main(int argc, char* argv[]) { std::vector<char> v0(25, '%'); std::vector<char> v1;
std::ostringstream ostr; boost::archive::text_oarchive(ostr) & v0;
std::istringstream istr(ostr.str()); boost::archive::text_iarchive(istr) & v1;
bool ok = (v0 == v1); return 0; }
I find this odd, to say the least! I've tried it on Visual C++ 7.1, using boost 1.33.0 and 1.33.1.
Regards, Jarl.
http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost