żeby nie przekopać znów połowę Internetu czy jest możliwe użycie funkcji z wieloma parametrami do for_each
np.
//to działa bez zarzutu
class Random_Int_srand {
int sub,sup;
public:
Random_Int_srand (int Sub, int Sup):sub(Sub),sup(Sup) {
srand(time(NULL));
}
int operator()(int &it) {
it=rand()%(sup-sub)+sub;
return it;
}
}
Random_Int_srand Trand_C(a,b);
std::for_each(begin(V5liczb),end(V5liczb),Trand_C);
std::copy(begin(V5liczb),end(V5liczb),ostream_iterator<int>(cout,",\t"));
// ale z funkcją dla for_each już nie wiem jak postąpić
int f(int a=17, int b=24) {
static std::random_device seed;
static std::mt19937 engine(seed());
std::uniform_int_distribution<int> dist(a,b);
return dist(engine);
}
std::for_each(begin(V5liczb),end(V5liczb),????????????????);
Nie chodzi mi o lambdę, bo to wiem tylko "zwykłą" funkcję z wieloma parametrami (int &, int sub, int sup).