Hi,
In below code snippet , can anyone let me know how to print the functor value output (3,4,5,6,7) without
embedding add function in class.
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void add ( int i)
{
i=i+2;
}
int main()
{
vector <int> vec ={1,2,3,4,5};
for_each(vec.begin(), vec.end(),add);
for (auto i:vec)
{
cout<<i;
}
return 1;
}