C++11???????Щ????????
???????????? ???????[ 2014/9/10 11:10:26 ] ??????????????? ??
??????????????find_if_not???????????μ????????ж?????????????
?????????????????copy_if??????????????copy??????????ж?????????????????????????????????÷???
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
vector<int> v = { 1?? 3?? 5?? 7?? 9?? 4 };
std::vector<int> v1(v.size());
//????????????
auto it = std::copy_if(v.begin()?? v.end()?? v1.begin()?? [](int i){return i%2!=0;});
//????vector???????С
v1.resize(std::distance(v1.begin()??it));
for(int i : v1)
{
cout<<i<<" ";
}
cout<<endl;
}
??????????????iota????????????????????У??????????????????????飬????????е???????????????????????????????????iota?????????????????????????????????????÷???
#include <numeric>
#include <array>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
vector<int> v(4) ;
//?????????????????????
//for(int i=1; i<=4; i++)
//{
// v.push_back(i);
//}
//??????iota????????飬?????
std::iota(v.begin()?? v.end()?? 1);
for(auto n: v) {
cout << n << ' ';
}
cout << endl;
std::array<int?? 4> array;
std::iota(array.begin()?? array.end()?? 1);
for(auto n: array) {
cout << n << ' ';
}
std::cout << endl;
}
???????????
????1 2 3 4
????1 2 3 4
??????????????iota????????????????????????????????iota???????????????????С??????????????У?vector<int> v(4) ;?????????????С?4??????????????
???????????????????????????С?????minmax_element??????????????????????С???????÷?????max_element??max_element??????????????????minmax_element??С??????????????????pair?з??????????????????÷???
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
// your code goes here
vector<int> v = { 1?? 2?? 5?? 7?? 9?? 4 };
auto result = minmax_element(v.begin()?? v.end());
cout<<*result.first<<" "<<*result.second<<endl;
return 0;
}
???????????
????1 9
??????????????is_ sorted??is_ sorted_until????is_sort?????ж????????????????????is_sort_until??????????????????????????????????С????????????????÷???
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
vector<int> v = { 1?? 2?? 5?? 7?? 9?? 4 };
auto pos = is_sorted_until(v.begin()?? v.end());
for(auto it=v.begin(); it!=pos; ++it)
{
cout<<*it<< " ";
}
cout<<endl;
bool is_sort = is_sorted(v.begin()?? v.end());
cout<< is_sort<<endl;
return 0;
}
???????????
????1 2 5 7 9
????0
?????????Щ?????????????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????