Is there any plan to include this code to a tuple header?
tuple_serialization.hpp ?
On Wed, Mar 5, 2008 at 2:57 PM, Sohail Somani
Hi,
Just thought I would share some code that serializes Boost.Tuple using Boost.Serialization:
#include
#include #include namespace boost { namespace serialization {
#define GENERATE_ELEMENT_SERIALIZE(z,which,unused) \ ar & boost::serialization::make_nvp("element",t.get< which >());
#define GENERATE_TUPLE_SERIALIZE(z,nargs,unused) \ template< typename Archive, BOOST_PP_ENUM_PARAMS(nargs,typename T) > \ void serialize(Archive & ar, \ boost::tuple< BOOST_PP_ENUM_PARAMS(nargs,T) > & t, \ const unsigned int version) \ { \ BOOST_PP_REPEAT_FROM_TO(0,nargs,GENERATE_ELEMENT_SERIALIZE,~) \ }
BOOST_PP_REPEAT_FROM_TO(1,10,GENERATE_TUPLE_SERIALIZE,~);
}}
It does not handle 0-element tuples (not sure that it should, actually!) Kudos to the insanity that produced Boost.Preprocessor.
-- Sohail Somani http://uint32t.blogspot.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Felipe Magno de Almeida