C++Primer P231 中的一个小问题
string::npos
#include<string>
#include<iostream>
int main()
{
string name("AnnaBelle");
int pos = name.find("Anna");
if ( pos == string::npos)
cout << "Anna not found!\n";
else cout << "Anna found at pos: " << pos << endl;
}
里面的string::npo是什么意思啊。 放在开头有什么作用呢?