On 08/18/2010 08:33 PM, Robert Ramey wrote:
So now 'unit' only has a template serialize method, but I still
int main() { unit u(42);
{ std::cout << "template:" << std::endl; test_oarchive ar(std::cout); ar << BOOST_SERIALIZATION_NVP(u); std::cout << std::endl; }
{ std::cout << "polymorphic:" << std::endl; polymorphic_test_oarchive ar(std::cout); ar << BOOST_SERIALIZATION_NVP(u); std::cout << std::endl; } }
Which outputs:
template:
42 polymorphic: 42
Code is attached.
what happens when you try:
std::cout << "polymorphic:" << std::endl; polymorphic_oarchive & po = polymorphic_test_oarchive ar(std::cout); po << BOOST_SERIALIZATION_NVP(u); std::cout << std::endl;
This would actually be using the polymorphic interface as it's intended to be used by routing the serialization through the polymorphic interface.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I added:
{ std::cout << "polymorphic with polymorphic_oarchive:" << std::endl; polymorphic_test_oarchive ar(std::cout); boost::archive::polymorphic_oarchive & po = ar; po << BOOST_SERIALIZATION_NVP(u); std::cout << std::endl; }
The output is:
template:
42 polymorphic: 42 polymorphic with polymorphic_oarchive: 42
-- Maxime