
Hello,
Thanks for the response.
Actually, I need to create dynamically functor, because I call a lot of
different methods coming from several classes.
see below:
MyObject myObject("before");
SetCommandstd::string,MyObject
cmd(myObject,&MyObject::setName,&MyObject::getName,"after");
Thus, I'm wondering if it is not possible to use the MPL library to
register the link between a class and it functor.
Example:
template
----- Original message ----- From: "Robert Ramey"
To: boost-users@lists.boost.org Subject: Re: [Boost-users] Serialization of functors and MPL Date: Thu, 16 Sep 2010 14:20:06 -0800 Anonymous user wrote:
Hello everybody,
I'm currently trying to serialize functors. ... Thanks in advance.
Without going through your specific situation, I can say that this is an easy problem. Here are a couple of ways to do it.
a) use boost::variant
Make your functors: f, g, h make a variant boost::variant
v; v = f or g or h ...
#include boost/serialization/variant.hpp serialize v
b) make your functors f, g, h all derived from a base class - functors make the base class polymorphic by making at least one member virtual EXPORT f, g, and h
functor *fx; fx = &f, or &g, or &h
serialize fx
c) There might be a way to do it with boost::any also.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-------------------------------------------------------------- Ovi Mail: Making email access easy http://mail.ovi.com