|
Boost : |
From: Christoph Ludwig (cludwig_at_[hidden])
Date: 2004-05-14 12:27:16
On Fri, May 14, 2004 at 09:14:53AM -0700, Robert Ramey wrote:
> Christoph Ludwig wrote:
> > Is it possible with the serialization library to serialize function
> > pointers and pointers to member functions? If it is not directly
> > supported, is there a "best practice" workaround? I didn't find this
> > info in the documentation.
>
> There's no information in the documentation about this. I'm not sure what
> it would mean to serialize a function pointer.
I agree it's hard to come up with a unique external representation of
the value of a function pointer. The most obvious candidate would be
the name of the referenced function, but
a) I have no idea whether this can be determined automatically and
portably at runtime.
b) it's likely to be implementation dependent, e.g., if the referenced
function is defined inside an unnamed namespace.
> Its possible it might be
> done by just defining non-intrusive serialize(ar, fp) as and empty function.
> I would have to think about this. However, I do believe that serialization
> of a function object would present no new issues. Then there is the
> possibility of creating a wrapper which makes a function object out a
> function pointer and serializing that. I'm sure already contains some
> objects of this nature. Please investigate this and report back.
In my use case, the possible values of the function pointers form a
small set known at compile time. I guess it won't be a problem to wrap
them in separate function objects that can be serialized. I will let
you know if I come up with a not too complicated workaround.
Regards
Christoph
-- http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/cludwig.html LiDIA: http://www.informatik.tu-darmstadt.de/TI/LiDIA/Welcome.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk