serialization: 2-arg template free function serialize
Robert, I have a number of types for which I've implemented the free serialize template function. I have also a number of fusion sequences. This is the code I came up with: namespace boost { namespace serialization { template <typename Archive> class SerializeMemberOfFusionSeq; /// fwd decl template <typename Archive, typename Seq> typename boost::enable_if_c<boost::fusion::traits::is_sequence<Seq>::value, void>::type serialize(Archive& ar, Seq& seq, unsigned int) { boost::fusion::for_each(seq, SerializeMemberOfFusionSeq<Archive>(ar)); } template <typename Archive> class SerializeMemberOfFusionSeq { public: SerializeMemberOfFusionSeq(Archive& ar) : ar_(ar) {} template <typename T> void operator()(T& t) const { ar_ & t; } private: Archive& ar_; }; } } Is the serialization library able to find the serialize() function this way? regards,
participants (1)
-
Hicham Mouline