|
Boost Users : |
Subject: Re: [Boost-users] Serialization of functors and MPL
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-09-16 18:20:06
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<f, g, h> 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 list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net