It can be done. I've wanted to add a "case
study" to the documentation but never have gotten around to it.
Basically here is the procedure.
a) Use a function object rather than a function
pointer. This should be easy to do.
b) derive your function object from a common base
class make your function
a virtual member of this class
c) make sure that the common base class has at
least one virtual function.
This makes it a polymorphic base
class.
d) include a variable which is a pointer to the
common base class - that
is a polymorphic pointer.
e) Assign a new function object of the desired
derived type to the polymorphic
pointer.
f) Save the polymorphic pointer as you would
any other polymorphic pointer.
g) Some other time and/or place, load the
polymorphic pointer as you would
any other polymorphic pointer.
h) You can now call your original function through
the pointer to it's base class
Note that this method is ocmplete portable at the
compile level. Also
note that the function object calls are portable
accross plattorms. That
is a function object saved on a VC platform can be
loaded on a gcc
platform. The key requirement is that the
function object be implemented
in both the savnig and loading
programs.
Robert Ramey
Hello everybody
This is my first post to the list.
Can I serialize C++ function pointer ? I search around and found that it
could not be done ( although I am not sure ).
If it can not be done, whats the explanation about it ?
Thanks
_______________________________________________
Boost-users mailing
list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users