I am actually trying to serialize a boost::function using boost::serialize because I want to share it in a boost::interprocess::message_queue. I only see one way to do that, it is to use the non-intrusive version of boost::serialize.
namespace boost {
namespace serialization {
template<class Archive>
void serialize(Archive & ar, boost::function<void()> & fct, const unsigned int version)
{
ar & fct.args;
ar & fct.arity;
ar & fct.vtable;
ar & fct.functor;
}
}
}
I will also need to serialize vtable and functor, I didn't try it, I am not sure it is working.
So is there any way to serialize a boost::function in a proper way?
Thank you.