Is there a STL method/boost class such as:
template<class S, class T>
class mem_mem : std::unary_function<T, S>
{
public:
mem_mem(S T::*_m) : m(_m) {}
S operator()(T &t) const {
return t .* m;
}
const S operator()(const T &t) const {
return t .* m;
}
private:
S T::*m;
};
It is similar to mem_fun but for fields.
You can use
boost::bindorboost::mem_fnfor this. If the member passed in is a member to a field,boost::bindacts as a functor that returns the data member.