serialization of standard unordered containers

I have a several classes that currently use old-fashioned ("ordered") containers that would benefit greatly from using the C++11 unordered variants. But in the version of boost I'm currently using (1.49.0) serialization of those containers is not supported. So I have some questions: 1. Is serialization of standard unordered containers supported in version 1.54.0 of the boost libraries? 2a. If so, what was the earliest version of the boost libraries that supported serialization of standard unordered containers? 2b. If not, is there a timetable for when this might be added? (The documentation and comments I could find gave completely inconsistent answers on this issue, so I'd like a definitive answer before I go to the trouble of installing a more recent version of boost if that's not going to help.) Doc -- Web: http://www.sff.net/people/N7DR

2013/7/27 D. R. Evans:
Alternatively, look at the YAS: https://github.com/niXman/yas -- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ ___________________________________________________ Another online IDE: http://liveworkspace.org/

2013/7/27 TONGARI J: Hi,
I recently need serialization and I'm glad to give it a try :) If you have any questions - please contact me.
-- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ ___________________________________________________ Another online IDE: http://liveworkspace.org/

2013/7/27 niXman
Actually it fails to compile with MSVC express 2013 preview, but works with my MinGW. And it seems that I can't include a single std_unordered_map_serializers that I need, but the whole std_types_serializers.
http://www.boost.org/doc/libs/1_54_0/libs/serialization/doc/todo.html#portab... Regards, J

2013/7/27 TONGARI J:
And it seems that I can't include a single std_unordered_map_serializers that I need, but the whole std_types_serializers.
Hmm... Works fine for me: http://pastebin.com/a0fEzk3z
http://www.boost.org/doc/libs/1_54_0/libs/serialization/doc/todo.html#portab... I need to think...
-- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ ___________________________________________________ Another online IDE: http://liveworkspace.org/

2013/7/27 Jason Roehm:
It doesn't seem to be explicitly stated in the README for YAS, but is C++11 required to use it? Yes.
-- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ ___________________________________________________ Another online IDE: http://liveworkspace.org/

2013/7/28 Brian Budge:
If so, is it any faster than boost::serialization? Yes, two-three times.
-- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ ___________________________________________________ Another online IDE: http://liveworkspace.org/

2013/7/28 niXman:
-- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ ___________________________________________________ Another online IDE: http://liveworkspace.org/

On Sun, Jul 28, 2013 at 11:56 AM, niXman
struct A {}; struct B : public A {}; struct C : public A {}; ... A *b = new B(); A *c = new C(); archive.serialize(b); archive.serialize(c); ... A *db, *dc; archive.deserialize(db); archive.deserialize(dc); // now db should be a pointer to identical contents to b, and concrete type B, and dc should be a pointer to identical contents to c and concrete type C Brian

On 07/26/2013 11:03 PM, D. R. Evans wrote:
1. Is serialization of standard unordered containers supported in version 1.54.0 of the boost libraries?
No, but you can add your own. Serialization of STL containers are implemented non-intrusively. See boost/serialization/set.hpp for an example.

Bjorn Reese said the following at 07/27/2013 02:45 AM :
I don't know what "non-intrusively" means in this context. I looked at the example, and the thought of trying to implement something similar for unordered sets sent me straight back to my user-level hole; I'll wait until someone who understands how this is supposed to work gets around to implementing it (it isn't, I assume, obvious even to those who have developed code for boost, otherwise it would, I expect, have been done already). I'll just live with old-fashioned sets in the meantime; they're fast enough for my current use-cases. Doc -- Web: http://www.sff.net/people/N7DR

On 07/29/2013 01:20 AM, D. R. Evans wrote:
I don't know what "non-intrusively" means in this context.
In this context it means that you do not have to alter any Boost classes (for further elaboration please see the Boost.Serialization documentation on free functions.)
It is less intimidating than it looks. You can simply copy the boost/serialization/set.hpp header and replace the type. In just five minutes I created the attached example that uses std:tr1::unordered_set.
participants (7)
-
Bjorn Reese
-
Brian Budge
-
D. R. Evans
-
Jason Roehm
-
niXman
-
Robert Ramey
-
TONGARI J