vector::const_iterator
#include<iostream>#include<vector>
using namespace std;
void main()
{
vector<string> text(10,"abc");
for(vector<string>::const_iterator iter = text.begin();iter!=text.end();iter++)
{
cout<<*iter<<endl;
}
}
编译无法通过
--------------------Configuration: fafafad - Win32 Debug--------------------
Compiling...
fafa.cpp
D:\c++\fafafad\fafa.cpp(9) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conv
ersion)
Error executing cl.exe.
fafafad.exe - 1 error(s), 0 warning(s)