You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am serializing a struct A which contains a few members include two length one std::vectors of struct B. B contains, among other things, a couple of strings. Struct A inherits from another class. Both structs (and the base class of the first) contain serialize methods that simply list all their members.
If I serialize to json, and then deserialize immediately, the result is correct. If I use a binary archive instead, however, then one of the strings in the first std::vector is wrong... it has the value of the corresponding string of the same member in the other std::vector!!
Any idea about what might be going on here or how to diagnose this? If not then I'll start trying to build an isolated repro case to figure out what is happening.
The text was updated successfully, but these errors were encountered:
struct B {
std::string bad;
std::string good;
};
struct A {
std::vector<B> first;
std::vector<B> second;
};
After deserialization, a.first[0].bad has been made a copy of a.second[0].good. And because we're using GCC <5.0 the string class is using ref counted data, so I know that the good string was copied (either explicitly or incidentally) to the bad string because the pointers to the string characters are identical.
Have worked around the problem for now, and will likely update the GCC version being used. Will not follow up on this issue unless it recurs (having read about the previous issue with GCC 4.8.x strings, I strongly suspect it is related).
I am serializing a struct A which contains a few members include two length one std::vectors of struct B. B contains, among other things, a couple of strings. Struct A inherits from another class. Both structs (and the base class of the first) contain serialize methods that simply list all their members.
If I serialize to json, and then deserialize immediately, the result is correct. If I use a binary archive instead, however, then one of the strings in the first std::vector is wrong... it has the value of the corresponding string of the same member in the other std::vector!!
Any idea about what might be going on here or how to diagnose this? If not then I'll start trying to build an isolated repro case to figure out what is happening.
The text was updated successfully, but these errors were encountered: