I have a vector of elements which I iterate through and call a method
on each of the elements. I want to do it using std::for_each
algorithm, but having a problem implementing it since the method that
I call on each element takes an argument and I don't know how to pass
this argument through. Here is the code using an old fashioned loop:
.......
std::vector<unsigned char bytes;
std::vector<Telements;
....
for (int i = 0; i < elements.size(); ++i) {
elements[i].serialize(bytes);
}
..........
could someone please help me out rewrite that using std::for_each?
Thanks!