如果没有 cout,程序将正确运行;为什么?输出缓存有问题?
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
class fn
{
public:
int i;
bool operator()(int,int)
{
++i;
cout<<"what the poodles?\n";
}
};
int main()
{
vector<int> temp(9,9);
vector<int> tmp(2,3);
fn f;
vector<int>::iterator ite;
ite=find_first_of(temp.begin(),temp.end(),tmp.begin(),tmp.end(),f);
if(ite==temp.end())cout<<"Pomeranians!\n";
//cout<<"compared "<<f.i<<" time(s)\n";//if note this ,you'll get defferent output.
return 0;
}