
Hi, I wrote some code where I want to iterate on the result of a regex matching and call a member function for each match. It goes roughly like this: ====================================================================== class XX { typedef bool (XX::*FuncPtr)(const boost::match_resultsstd::string::const_iterator& what); FuncPtr funcPtr; }; bool XX::regex_callback(const boost::match_resultsstd::string::const_iterator& what) { return true; } void XX::addDelayedVariables(string expr) { funcPtr = &XX::regex_callback; regex re("([[:alpha::]][[:alnum]]+)(\[[^\\]]+])"); sregex_iterator m1(expr.begin(), expr.end(), re); sregex_iterator m2; match_resultsstring::const_iterator results; (*) bool a = (this->*funcPtr)(results); (*) for_each(m1, m2, (this->*funcPtr)); (#) } =========================================================================== When compiling (gcc 4.1 on FC 6) I get an error message at (#) that says: invalid use of non-static member function I added the two lines with a (*) as a sanity check to see that I declared the pointer-to-member-function correctly, and I have no problem compiling those. So my question is: is this a problem with me not understanding how to handle pointer-to-member-functions in C++, or is there something with the boost libraries that I'm missing or is preventing me from performing this operation? I would appreciate any help or opinion. thanks, Alain