Is it common to use something like the following in C++?
template <typename T> function<void(vector<T> &)> filter1 = [ ] (vector<T> &vec){
int count = 0;
for (T t : vec){
if ( t.cost < 500 )
vec.erase(vec.begin()+count);
count++;
}
};
template <typename T> void discount(float p, vector<T> &vec){
filter1<T>(vec);
int count = 0;
for (T t : vec) {
t.cost = t.cost - t.cost * p;
vec.erase(vec.begin() + count);
vec.emplace(vec.begin() + count, t);
count++;
}
btw I'm calling it tembda, cause its a mixture of Template and Lambda.