如下小程序:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> v;
string s;
char* p="!";
while(cin>>s)
{
v.push_back(s);
if(strcmp(s,p)==0)//编译时这句有错,error C2664: 'strcmp' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
break;
}
return 0;
}