c++ primer里的一段代码有问题?
刚开始学c++ primer,讲到iterator时有一段代码,讲解它的用法,我试着把代码补全之后用VC编译出现4个warning,请大家帮忙讲解一下是什么原因。代码如下:#include <iostream>
#include <string>
#include <vector>
using namespace std;
using std::vector;
using std::string;
using std::cin;
using std::cout;
using std::endl;
int main()
{
string word;
vector<string> text;
while(cin>>word)
{
text.push_back(word);
}
for(vector<string>::iterator i=text.begin(); i != text.end(); ++i)
cout<<(*i)<<endl;
cout<<endl;
return 0;
}
出现4个warning:
F:\Microsoft Visual Studio\MyProjects\practice\practice.cpp(30) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information
F:\Microsoft Visual Studio\MyProjects\practice\practice.cpp(30) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::
basic_string<char,std::char_traits<char>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncated to '255' characters in the debug information
f:\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::vector<std
::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
f:\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::~vector<st
d::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
practice.obj - 0 error(s), 4 warning(s)