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: Member function using pointer to member function


Volker Boerchers <boercher@physik.uni-bremen.de> writes:

> the following code is accepted by gcc version 2.7.2.1:

gcc 2.7.2.1 was based on an old draft of the C++ standard, that
allowed the construct you're using (or maybe it accepted it as an
extension, I'm not sure)

> class A { double ff(double (A::*func)(double), double t); };
    
> double A::fff(double t) { return ff(&f, t); }

>   A.cc: In method `double A::ff(double (A::*)(double), double)':
>   A.cc:15: must use .* or ->* to call pointer-to-member function in `func
> (...)'

> Who is wrong; what can i do to make it work?

Spell it `(this->*ff)(&f,t);' and it will work.

-- 
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]