I'm making these classes, Expression_Set and Variable_Set into a template class called Set. I have a function that looks like this:
Code:
template<typename T> void Set::expand_factor_expressions() {
algo::for_each(members.begin(),members.end(),&T::expand_factor_expressions);
}
Here's my for_each function (declared in namespace algo):
Code:
template<typename _Iterator, typename _Function>
_Function for_each(_Iterator a, _Iterator z, _Function t) {
for (;a != z; ++a)
((*a).*t)();
return t;
}
I can't compile expand_factor_expressions because one of the arguments needs to contain the template. Is there a way around this? I could expand for_each, but I'd rather look for a more elegant solution.