
OvermindDL1 wrote:
Yes, the boost function just holds a pointer to a templated struct that is refined based on the function itself, that is how that struct know how to do everything, kind of like a subclass with a single virtual function.
Yes, I guess I got that part. My question was actually: when is the deserialization code generated? Due to the deferred calling, it can only be done on the point of function invocation, i.e., without an actual function call, there's no deserialization code? On the receiving side, you have id -> boost::function where this function knows what to do based on the arguments passed on the sending side. I.e., how does the receiving side know what to deserialize? If you do auto my_func = register.get( func_type, id ); and later on my_func( arg1, arg2, arg2 ); doesn't this require to somehow register the fusion vector for the arguments, too? I mean, if you generate somehow boost::function< void( void*, std::size_t ) > m_type_erased_functor = my_func.magic_trick(); then, at that point, my_func hasn't seen { arg1, arg2, arg3 } yet. Is there another trick to tackle this? Cheers, Rutger