#include "stdafx.h"
#include <algorithm>
#include <iostream>
#include <vector>
#include <iterator>
int _tmain(int argc, _TCHAR* argv[])
{
std::vector<int> vec;
int sz[] = {1, 7, 4, 2};
std::copy(sz, sz + 4, std::back_inserter(vec));
std::for_each(sz, sz + 4, [](int n){ std::cout << n << " "; });
std::cout << std::endl;
std::sort(vec.begin(), vec.end(), [](int x, int y) { return x < y; });
std::for_each(vec.begin(), vec.end(), [](int n){ std::cout << n << " "; });
std::cout << std::endl;
std::sort(vec.begin(), vec.end(), [](int x, int y) { return x > y; });
for (auto itor = vec.begin(); itor != vec.end(); ++itor)
std::cout << *itor << " ";
return 0;
}
c++0x整合了一些boost的东西,c++终于也可以拥有script language的快捷手感了。