这句话是什么意思std::string::npos
下面的代码片段是什么意思?
found = str.find(str2);
if (found != std::string::npos)
std::cout << "first 'needle' found at: " << int(found) << std::endl;
就是没找到的意思。
它通常是这样定义的:
static const size_t npos = -1;
最好与 npos 进行比较,而不是与 -1 进行比较,因为代码更清晰。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)