My example is as below. I found out the problem is with "const" in function void test's parameter. I don't know why the compiler does not allow. Could anybody tell me? Thanks.
vector<int> p;
void test(const vector<int> &blah)
{
vector<int>::iterator it;
for (it=blah.begin(); it!=blah.end(); it++)
{
cout<<*it<<" ";
}
}
int main()
{
p.push_back(1);
p.push_back(2);
p.push_back(3);
test(p);
return 0;
}