将字符串(以char*形式给出)解析为int的C++方式是什么?强大而清晰的错误处理是一个优点(而不是返回零).
c++ parsing
正如标题中所提到的,我正在寻找能够比atoi更具性能的东西.目前,我所知道的最快的方式是
atoi(mystring.c_str())
最后,我更喜欢不依赖Boost的解决方案.这样做有没有人有很好的表现技巧?
附加信息:int不会超过20亿,它总是正数,字符串中没有小数位.
c++ string int performance type-conversion
c++ ×2
int ×1
parsing ×1
performance ×1
string ×1
type-conversion ×1