psy*_*che 15 c++ string boost
假设我有一个字符串,我想找到一个特定字符(如"|")是否存在,这是最好和最快的技术是什么?我知道字符串查找实现.我要求比这更快的实现.
Fre*_*son 32
使用 std::string::find
std::string::find
if (str.find('|') != std::string::npos) { // ... }
不太可能有更高效的东西.O(n)是你能做的最好的.标准库实现应该是非常优化的.
归档时间:
12 年,10 月 前
查看次数:
54199 次
最近记录:
8 年,1 月 前