If you’re only going to do the thing once than just use a loop, if you going to do it regular, then why not make your own func with an interface you like. Below is how I would go about it.
// Non iterator version
template<class A, class B>
void apply_methodX(std::vector<A> & vec_a, std::vector<B> & vec_b, size_t len, void(A::*method)(B)) {
for (size_t i(0); i < len; ++i) {
(vec_a[i].*method)(vec_b[i]);
}
}
// Iterator version
template<class A, class B>
void apply_method_it(typename std::vector<A>::iterator first_a, typename std::vector<A>::iterator last_a, typename std::vector<B>::iterator first_b, void(A::*method)(B)) {
for (; first_a != last_a; ++first_a, ++first_b) {
(*first_a.*method)(*first_b);
}
}
Void main{
std::vector<A> vec_a;
std::vector<B> vec_b;
// assign blah blah into vectors…
apply_methodX<A, B>(vec_a, vec_b, vec_a.size(), &A::A_method);
apply_method_it<A, B>(vec_a.begin(), vec_a.end(), vec_b.begin(), &A::A_method);
}