asetof...@gmail.com wrote in news:593ee2f2-a0cb-44c4-9778-
5fa3f1...@googlegroups.com:
Yes this is possible (ssuming I have interpreted your mumbling
correctly):
#include <vector>
#include <cassert>
#include <cstdlib>
template<typename T>
std::vector<T> operator%(const std::vector<T>& v, T (*f)(T)) {
std::vector<T> result;
for(auto x: v) result.push_back((*f)(x));
return result;
}
int main() {
std::vector<int> v = {1, -2, 3, -4};
std::vector<int> w = v % std::abs;
assert(w[3]==4);
}