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:
1. Is serialization of standard unordered containers supported in version 1.54.0 of the boost libraries? No.
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/
Hi,
2013/7/27 niXman
2013/7/27 D. R. Evans:
1. Is serialization of standard unordered containers supported in version 1.54.0 of the boost libraries? No.
Alternatively, look at the YAS: https://github.com/niXman/yas
I recently need serialization and I'm glad to give it a try :) Does it solves the concern of portable binary archive as described in Boost.Serialization? Thanks.
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.
Does it solves the concern of portable binary archive as described in Boost.Serialization? Please explain what you mean?
-- 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
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.
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.
Does it solves the concern of portable binary archive as described in Boost.Serialization? Please explain what you mean?
http://www.boost.org/doc/libs/1_54_0/libs/serialization/doc/todo.html#portab... Regards, J
2013/7/27 TONGARI J:
Actually it fails to compile with MSVC express 2013 preview, but works with my MinGW. Do you have an code sample and compiler output?
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/
On Jul 27, 2013, at 2:41 AM, niXman
2013/7/27 D. R. Evans:
1. Is serialization of standard unordered containers supported in version 1.54.0 of the boost libraries? No.
Alternatively, look at the YAS:
It doesn't seem to be explicitly stated in the README for YAS, but is C++11 required to use it? Also, how would you characterize its maturity level? It seems that it is still under active development. Jason
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.
Also, how would you characterize its maturity level? It seems that it is still under active development. YAS was written three years ago as part of a commercial project, and it was decided to make its code available under BSD3 license. Since then, YAS was used in two more commercial projects.
-- 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 Fri, Jul 26, 2013 at 11:41 PM, niXman
2013/7/27 D. R. Evans:
1. Is serialization of standard unordered containers supported in version 1.54.0 of the boost libraries? No.
Alternatively, look at the YAS: https://github.com/niXman/yas
Can this library do serialization through a base pointer? If so, is it any faster than boost::serialization?
2013/7/28 Brian Budge:
Can this library do serialization through a base pointer? Yes. https://github.com/niXman/yas/blob/master/examples/serialization-method-7-te...
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:
2013/7/28 Brian Budge:
Can this library do serialization through a base pointer? Yes. Although I'm not sure I understand you correctly...
-- 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
2013/7/28 niXman:
2013/7/28 Brian Budge:
Can this library do serialization through a base pointer? Yes. Although I'm not sure I understand you correctly...
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 :
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.
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.)
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.
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.
Bjorn Reese wrote:
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.)
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.
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.
Note that there is a trac item which has been submitted to support unordered containers. I haven't had time to add it in. I'm also concerned about the consumption of testing time entailed by adding a few additional tests. Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (7)
-
Bjorn Reese
-
Brian Budge
-
D. R. Evans
-
Jason Roehm
-
niXman
-
Robert Ramey
-
TONGARI J