#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
template <class T> struct Out
{
ostream& out;
Out(ostream& o):out(o){}
void operator()(const T& val){out<<val<<" ";}
};
int main() {
int t[]={3,2,4,1,5,6,10,8,7,9};
vector<int> v1(t,t+10);
for_each(v1.begin(),v1.end(), bind2nd(plus<int>(),1));
for_each(v1.rbegin(), v1.rend(), Out<int>(cout)); cout<<endl;
return 0;
}
Hello everyone. I have question about this code.
When I run this code and the result states for_each(v1.begin(),v1.end(), bind2nd(plus(),1)); is deprecated.
I am not sure why this statement is appeared and how can I fix this?
Thank you.