#include<iostream>
#include<vector>
#include <list>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
vector<int> vec1;
list<int> list1;
for (int k=0;k<10;k++)
{
vec1.push_back(k);
}
vector<int>::iterator vec_iter1;
for (vec_iter1 = vec1.begin();vec_iter1 != vec1.end();++vec_iter1)
{
cout << *vec_iter1 << " ";
}
cout << endl;
cout << "------------------------------------------------------" << endl;
transform(vec1.begin(),vec1.end(),vec1.begin(),negate<int>());
for (vec_iter1 = vec1.begin(); vec_iter1 != vec1.end(); ++vec_iter1)
{
cout << *vec_iter1 << " ";
}
cout << endl;
cout << "------------------------------------------------------" << endl;
system("pause");
return 0;
}
=====================================================
0 1 2 3 4 5 6 7 8 9
------------------------------------------------------
0 -1 -2 -3 -4 -5 -6 -7 -8 -9
------------------------------------------------------
请按任意键继续. . .