I
Imre Palik
Hi'yal,
consider this code:
class A
{
class B
{
void (A::*mptr)();
public:
B();
};
void do_something();
};
void
A::do_something() {}
A::B::B() : mptr(do_something) {} // error here
trying to compile it with gcc gives the following error:
m.cpp:17: error: argument of type `void (A:()' does not match `void (A::*)()'
I fail to see the difference between these two types. Anybody cares to
explain? Changing the problematic line to
A::B::B() : mptr(&do_something) {} // error here
I get the following error message:
m.cpp:17: error: ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say `&A::do_something'
I cannot find the relevant part of the standard. Could somebody point me
to it?
Thx
ImRe
consider this code:
class A
{
class B
{
void (A::*mptr)();
public:
B();
};
void do_something();
};
void
A::do_something() {}
A::B::B() : mptr(do_something) {} // error here
trying to compile it with gcc gives the following error:
m.cpp:17: error: argument of type `void (A:()' does not match `void (A::*)()'
I fail to see the difference between these two types. Anybody cares to
explain? Changing the problematic line to
A::B::B() : mptr(&do_something) {} // error here
I get the following error message:
m.cpp:17: error: ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say `&A::do_something'
I cannot find the relevant part of the standard. Could somebody point me
to it?
Thx
ImRe