Based on std::transform
template < class InputIterator, class OutputIterator, class UnaryOperator >
OutputIterator transform ( InputIterator first1, Inpu
It is pretty easy to do if you wrap the call in lambda:
#include
#include
class C {
public:
int op() const { return 1; }
};
class D {
int op() { return 1; }
void f() {
std::vector xs;
std::vector ys;
std::transform(xs.begin(), xs.end(), ys.begin(),
[](const C& x) { return x.op(); });
std::transform(xs.begin(), xs.end(), ys.begin(),
[this](const C& x) { return this->op(); });
}
};