Boost logo

Boost Users :

Subject: Re: [Boost-users] Member-Function to String conversion.
From: Siegfried Kettlitz (siegfried.kettlitz_at_[hidden])
Date: 2008-11-03 09:48:06


> You need two maps (string->pointer and pointer->string), a bimap should do
> the work. Isn't it possible to cast a function pointer to a generic void *
> pointer as the base class for the bimap?

Sorry, this doesn't work. A "pointer to a member function" is _not_ a
"function pointer" and not a general (void*) pointer. It's size is
bigger than a pointer to a normal function because it stores
additional information about the object. I haven't found a conversion
between all "pointer to member functions" to something "comparable"
like a normal pointer or a number or a string. (Maybe typeinfo helps?
Is it portable?)

Take a look at this for the strange objects that member function pointers are:
> http://www.codeproject.com/KB/cpp/FastDelegate.aspx


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