|
Boost Users : |
Subject: [Boost-users] Compiler does not give error for missing serialize function
From: Elizabeta (elizabeta.petreska_at_[hidden])
Date: 2016-04-22 08:38:08
Hi
I have the following code :
class MyClass
{
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive &ar, const unsigned int version) {}
};
class MyClass2 : public MyClass {};
MyClass2* ss = new MyClass2;
std::ofstream ofs("C:\\test.xml");
boost::archive::xml_oarchive oa(ofs);
oa & boost::serialization::make_nvp("test",ss);
I am serializing trough the derived class pointer. The derived class doesnot
have serialize function. The Base have. And I was expecting compiler to give
me error that MyClass2 doesnot have serialize function. But this code
compiles without errors. I am using vs2010.
-- View this message in context: http://boost.2283326.n4.nabble.com/Compiler-does-not-give-error-for-missing-serialize-function-tp4685551.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net