boost serialization + boost variant + boost blank
I'm running Boost 1.57.0 using serialization, variant, and boost::blank with that variant. I found that when compiled, serialization complains that blank does not contain a serialize method, which is true. I made a copy of blank.hpp, called it blank.h, and added template< class Archive > void serialize(Archive& ar, const unsigned int version) {} to the body of struct blank. That made the compiler happy, but is it a fix in general?
Check out non-intrusive serialization: http://www.boost.org/doc/libs/1_57_0/libs/serialization/doc/tutorial.html#no... Maybe that will work for you without modifying the class. Mit freundlichen Grüßen / With best regards Andreas Iwanowski - IT Administrator / Software Developer www.awato.de | namezero@afim.info T: +49 (0)2133 26031 55 | F: +49 (0)2133 26031 01 awato Software GmbH | Salm Reifferscheidt Allee 37 | D-41540 Dormagen avisor-Support | T: +49 (0)621 6094 043 | F: +49 (0)621 6071 447 Geschäftsführer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158 -----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Merrill Cornish Sent: Sunday, 01 February, 2015 18:41 To: boost-users@lists.boost.org Subject: [Boost-users] boost serialization + boost variant + boost blank I'm running Boost 1.57.0 using serialization, variant, and boost::blank with that variant. I found that when compiled, serialization complains that blank does not contain a serialize method, which is true. I made a copy of blank.hpp, called it blank.h, and added template< class Archive > void serialize(Archive& ar, const unsigned int version) {} to the body of struct blank. That made the compiler happy, but is it a fix in general? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
If simply defining an empty serialize() function really works, then your suggestion is best. Next, question, does it really work--or just temporarily satisfy the compiler.
If you must serialize the variant then a serialize() will have to be defined for every type. Unless I have misunderstood what you mean by "really works": It's not about satisfying the compiler, but rather telling it how to serialize this member. By telling it (with an empty serialize() ) to not serialize or de-serialize anything, it works appropriately, as long as you read/write the same data in the same order (i.e. nothing :) ) Mit freundlichen Grüßen / With best regards Andreas Iwanowski - IT Administrator / Software Developer www.awato.de | namezero@afim.info T: +49 (0)2133 26031 55 | F: +49 (0)2133 26031 01 awato Software GmbH | Salm Reifferscheidt Allee 37 | D-41540 Dormagen avisor-Support | T: +49 (0)621 6094 043 | F: +49 (0)621 6071 447 Geschäftsführer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158 -----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Merrill Cornish Sent: Sunday, 01 February, 2015 21:16 To: boost-users@lists.boost.org Subject: Re: [Boost-users] boost serialization + boost variant + boost blank If simply defining an empty serialize() function really works, then your suggestion is best. Next, question, does it really work--or just temporarily satisfy the compiler. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 02/01/2015 02:25 PM, Andreas M. Iwanowski wrote:
If you must serialize the variant then a serialize() will have to be defined for every type.
Unless I have misunderstood what you mean by "really works": It's not about satisfying the compiler, but rather telling it how to serialize this member. By telling it (with an empty serialize() ) to not serialize or de-serialize anything, it works appropriately, as long as you read/write the same data in the same order (i.e. nothing :) )
Shouldn't the serialization library recognize empty classes (through boost:is_empty) and handle those cases automatically?
Mit freundlichen Grüßen / With best regards
Andreas Iwanowski - IT Administrator / Software Developer www.awato.de | namezero@afim.info T: +49 (0)2133 26031 55 | F: +49 (0)2133 26031 01 awato Software GmbH | Salm Reifferscheidt Allee 37 | D-41540 Dormagen
avisor-Support | T: +49 (0)621 6094 043 | F: +49 (0)621 6071 447
Geschäftsführer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158
-----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Merrill Cornish Sent: Sunday, 01 February, 2015 21:16 To: boost-users@lists.boost.org Subject: Re: [Boost-users] boost serialization + boost variant + boost blank
If simply defining an empty serialize() function really works, then your suggestion is best. Next, question, does it really work--or just temporarily satisfy the compiler. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Ioannis Papadopoulos-2 wrote
Shouldn't the serialization library recognize empty classes (through boost:is_empty) and handle those cases automatically?
serialization of an empty class is not an legal operation. Robert Ramey -- View this message in context: http://boost.2283326.n4.nabble.com/boost-serialization-boost-variant-boost-b... Sent from the Boost - Users mailing list archive at Nabble.com.
Robert Ramey wrote
Ioannis Papadopoulos-2 wrote
Shouldn't the serialization library recognize empty classes (through boost:is_empty) and handle those cases automatically? serialization of an empty class is not an legal operation.
Whoops - I meant to say that serialization of an empty class IS a legal operation Robert Ramey -- View this message in context: http://boost.2283326.n4.nabble.com/boost-serialization-boost-variant-boost-b... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (4)
-
Andreas M. Iwanowski
-
Ioannis Papadopoulos
-
Merrill Cornish
-
Robert Ramey