#include <iostream>
#include <Algorithm>
#include <string>
#include <vector>
using namespace std;
int main()
{
//count
vector<int> vec = {1,2,2,34,4,5,6,71,85,9};
int num = count_if(vec.begin(), vec.end(), [](int x) {return x > 50; });
//min max
auto it1 = max_element(vec.begin(),vec.end());
auto it2 = max_element(vec.begin(), vec.end(), [](int x, int y) {return (x % 10) < (y % 10); });
auto it2 = min_element(vec.begin(),vec.end());
//数据无序
auto it4 = find(vec.begin(),vec.end(),71);
auto it5 = find_if(vec.begin(), vec.end(), [](int x) {return x > 50; });
auto it6 = find_if_not(vec.begin(), vec.end(), [](int x) {return x > 50; });
auto it7 = search_n(vec.begin(), vec.end(), 2,2);
//搜素某种模式
vector<int>subvec = { 1,2,2 };
auto it8 = search(vec.begin(), vec.end(), subvec.begin(), subvec.end());
auto it9=find_first_of(vec.begin(), vec.end(), subvec.begin(), subvec.end());
auto it10 = adjacent_find(vec.begin(),vec.end());//寻找两个相同的元素
auto it11 = adjacent_find(vec.begin(), vec.end(), [](int x, int y) {return x == 2 * y; });
//比较
vector<int>vec2 = {1,2,3,4,5,6,7,8,9};
if ( equal(vec.begin(),vec.end(),vec2.begin()))
{
cout << "" << endl;
}
//逐个比较元素是否<
lexicographical_compare(vec.begin(),vec.end(),vec2.begin(),vec2.end());
//
is_sorted(vec.begin(),vec.end());
auto it13 = is_sorted_until(vec.begin(),vec.end());//找到第一个不排序的元素
is_heap(vec.begin(),vec.end());//判断是否为堆
is_heap_until(vec.begin(),vec.end());
//
all_of(vec.begin(), vec.end(), [](int x) {return x > 80; });
any_of(vec.begin(), vec.end(), [](int x) {return x < 80; });
none_of(vec.begin(), vec.end(), [](int x) {return x < 80; });
system("pause");
return 0;
}