I'd like to use a pointer to member function in C++, but it doesn't work:
pointer declaration:
int (MY_NAMESPACE::Number::*parse_function)(string, int);
pointer assignation:
parse_function = &MY_NAMESPACE::Number::parse_number;
This call works perfectly (itd is an iterator to elements of a map):
printf("%s\t%p\n",itd->first.c_str(),itd->second.parse_function);
But this one doesn't work:
int ret = (itd->second.*parse_function)(str, pts);
$ error: 'parse_function' was not declared in this scope
And this one neither
int ret = (itd->second.*(MY_NAMESPACE::Number::parse_function))(str, pts);
$ [location of declaration]: error: invalid use of non-static data member 'MY_NAMESPACE::Number::parse_function'
$ [location of the call]: error: from this location
I don't understant why ...
Thx in advance !!