|
Boost Users : |
Subject: [Boost-users] [serialization] Different behaviors between archive and its polymorphic variant
From: Maxime van Noppen (maxime_at_[hidden])
Date: 2010-08-07 09:54:50
Hi,
I'm trying to make a custom archive class that works either with the
template flavor or via the polymorphic_archive. It compiles but produces
a different behavior and I can't find why.
Basically I did a trivial oarchive class that overloads (via
save_override) how are treated NVP. When used with the template version
it works, whereas with the polymorphic version it doesn't.
The code is attached. There is a preprocessor switch to choose the
template or polymorphic version (-DPOLY).
$ g++ poly.cc -lboost_serialization && ./a.out
<name=u><name=id_>42</name=id_>
</name=u>
$ g++ -DPOLY poly.cc -lboost_serialization && ./a.out
42
This is with Boost 1.43 and g++ 4.5.0.
I looked at various archive implementations but couldn't find any code
that I could relate to this problem.
Thanks,
-- Maxime
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