您的位置:首页 > 编程语言

如下代码中greater10函数调用时实参是如何传递的呢? 代码是MSDN中的一个例子

2010-05-17 16:25 483 查看
#include <vector>
#include <algorithm>
#include <iostream>

bool greater10(int value)
{
return value >10;
}

int main()
{
using namespace std;
vector<int> v1;
vector<int>::iterator Iter;

v1.push_back(10);
v1.push_back(20);
v1.push_back(10);
v1.push_back(40);
v1.push_back(10);

cout << "v1 = ( ";
for (Iter = v1.begin(); Iter != v1.end(); Iter++)
cout << *Iter << " ";
cout << ")" << endl;

vector<int>::iterator::difference_type result1;
result1 = count_if(v1.begin(), v1.end(), greater10);
cout << "The number of elements in v1 greater than 10 is: "
<< result1 << "." << endl;

system("pause");
}

greater10函数调用时,实参是如何传递的呢?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐