#include
#include
#include
#include
using namespace std;
//自定义函数声明
bool isOdd(int);
//主函数
int main(int argc,char * argv[])
{
//定义向量vector对象
vector myVector;
//循环插入元素
for(int i=1;i<10;++i)
myVector.push_back(i);
//定义迭代器变量
vector::iterator bound,it;
//partition
bound=partition(myVector.begin(),myVector.end(),isOdd);
cout<
//循环输出
for(it=myVector.begin();it!=bound;it++)
{
cout<
}
cout<
//循环输出
for(it=bound;it!=myVector.end();it++)
{
cout<
}
cout<
system("pause");
return 0;
}
//自定义函数
bool isOdd(int i)
{
return (i%2)==1;
}
谁能说说是怎么回事啊?
为什么for循环里的it++和++it输出结果一样?