Serialization: Cannot use name-value-pairs with indirectly serialized maps.
Hello,
While evaluating the serialization library, I've ran into a problem
while modifying my code to add name value pairs to the serialized
objects in order to be able to serialize them to an xml file.
before doing this, everything worked fine, but now that I'm using NVPs,
I get the following error:
c:\projects\dev_tools\libs\c++\boost_1_32_0\boost\serialization\access.hpp(106):
error C2039: 'serialize' : is not a member of 'std::map<_Kty,_Ty>'
with
[
_Kty=std::string,
_Ty=std::string
]
I'm using VC 7.1, and a stripped-down but compilable version of the code
that causes the problem is included at the end of this mail.
I'm really puzzled at this problem as the following modifications to the
code will have things compile:
-) Comment out only the 'oa << BOOST_SERIALIZATION_NVP(instanceOfB);' line.
-) Comment out only the 'ia >> BOOST_SERIALIZATION_NVP(instanceOfB);' line.
-) Serializing and unserializing directly the instanceOfA object instead.
-) redefining BOOST_SERIALIZATION_NVP to 'BOOST_SERIALIZATION_NVP(x) x'
is this really a bug or am I missing something ?
Thanks!
Martin
------------------------------------------------------------------------
#include <iostream>
#include <fstream>
#include <string>
#include
signatureHmm, I just compiled it with VC 7.1, it passes gcc 3.3 and borland
5.64 as well. Note, my personal version is 1.32+ so that could explain it
It did fail for me (with the same error) with Comeau - same message more or
less ?
Its a mystery to me. Does test_map pass in your environment?
Robert Ramey
"Martin Proulx"
Robert Ramey wrote:
signatureHmm, I just compiled it with VC 7.1, it passes gcc 3.3 and borland 5.64 as well. Note, my personal version is 1.32+ so that could explain it
Fails for me on VC7.1 with 1.32.
It did fail for me (with the same error) with Comeau - same message more or less ?
Adding #define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP allows it to compile and link. I haven't tried running it. As I previously reported I've had similar problems when serialising std::set<string>'s. Jeff
Jeff Flinn wrote:
Robert Ramey wrote:
signatureHmm, I just compiled it with VC 7.1, it passes gcc 3.3 and borland 5.64 as well. Note, my personal version is 1.32+ so that could explain it
Fails for me on VC7.1 with 1.32.
It did fail for me (with the same error) with Comeau - same message more or less ?
Adding
#define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
allows it to compile and link. I haven't tried running it. As I previously reported I've had similar problems when serialising std::set<string>'s.
Jeff
This does the trick for me as well. I'm now able to serialize things to XML! Thanks! Martin
Robert Ramey wrote:
signatureHmm, I just compiled it with VC 7.1, it passes gcc 3.3 and borland 5.64 as well. Note, my personal version is 1.32+ so that could explain it
It did fail for me (with the same error) with Comeau - same message more or less ?
Its a mystery to me. Does test_map pass in your environment?
Robert Ramey
Yes, all the boost synchronization tests do compile and pass. Martin
participants (3)
-
Jeff Flinn
-
Martin Proulx
-
Robert Ramey