This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: bound pointer to member
On Wed, 2011-02-23 at 11:54 +0100, Klaus Rudolph wrote:
> OK, maybe a missunderstanding or a wrong naming for my problem...
>
> What I am searching for is the following:
>
> class A
> {
> void AnyFunc();
> }
>
> int main()
> {
> A a1;
> A a2;
>
> ...anyPointerDefinition ptr1;
> ...anyPointerDefinition ptr2;
>
> ptr1= &(a1.Func);
> ptr2= &(a2.Func);
>
> //call the pointers as functions
> ptr1();
> ptr2();
> }
You probably want to use the Boost Function library for this:
http://www.boost.org/doc/libs/1_46_0/doc/html/function/tutorial.html#id1275012