I am trying to generalize the functions filterX()
and filterY()
in the following class Table
to function filter()
.
Here is the syntax for the way you want:
vector Table::filter(string s, string (Row::*get)() const)
{ //^^^^^^^^^^^^^^^^^^^^^^^^^^^ member pointer
...
if(((*it).*get)() == s) { // call using the (*it). and not it->
...
}
Call it as:
vector vx = t.filter("x1", &Row::getX);
vector vy = t.filter("y2", &Row::getY);