This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: sorry not implemented: address of bound pointer-to-member function


A P Zijlstra <peter@mcs.nl> writes:

> this will pass the return value of Interface::some_function to Cfunc,

Sorry, I had missed the statement that you wanted a pointer to member.
The only way to obtain a pointer to member is
`&Interface::some_function', but this is a pointer-to-member-function,
not the address of a function, unless some_function is a static member
function.

> Fredrik rightly pointed out that this is somewhat more complex than
> I initially thought, this as the function pointer itself has to
> 'remember' which class instanitasion it belongs to.

You if really need this, you must consider using functors, such as
`bind1st(if, mem_fun(&Interface::some_function))'

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]