Polymorphic serialization compile error.
I'm trying to compile (with VS 2005) a simple example of serialization
(boost 1.34) of a polymorphic class, but I get the following compile error:
basic_xml_oarchive.hpp(83) : error C2027: use of undefined type
'boost::STATIC_ASSERTION_FAILURE<x>'
1> with
1> [
1> x=false
1> ]
Can you help me? I've read the documentation and I didn't understand the
difference with the example that I found in there.
Here is the source:
-----------------------------------------------------------------
//main.cpp
#include <iostream>
#include <fstream>
#include "boost/archive/xml_oarchive.hpp"
#include "boost/archive/xml_iarchive.hpp"
#include
Try the following. See the "rationale" in the documentation for an explanation. Robert Ramey ... int main() { const derived dc(5); // try adding "const" here { std::ofstream ofile("test.xml"); boost::archive::xml_oarchive oa(ofile); oa << boost::serialization::make_nvp("test", dc); } return 0;
participants (2)
-
mik
-
Robert Ramey