今天下午看了半天STL,还是十分的迷茫。自己做个练习还有错误,郁闷那!!
#include <iostream>
#include <string.h>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;
int main()
{
list<string> listText;
list <string>::iterator itTemp;
listText.push_back("who am i");
listText.push_back("hello world");
listText.push_back("james");
listText.push_back("windows mobile");
//listText.push_front("james");
//listText.push_front("windows mobile");
itTemp = find(listText.begin(), listText.end(), "jiames");
if (itTemp == listText.end())
{
cout<<"no find"<<endl;
}
else
{
cout<< *itTemp<<endl;
}
return 0;
}
有个错误,不知道什么原因。
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion)
有牛人知道么,请教下。
转载于:https://blog.51cto.com/turnyou/481760