boost 库学习

1:

  lexical_cast 转化 

   string =3333333333; 超过int 型表示范围 但不超过unsigned int 型 

   这样是可以的。。。 完全抛弃了什么atoi atol strtol 神马神马的 太简单咯。。。

  #include <iostream>

#include <boost/lexical_cast.hpp>

using namespace std;

using namespace boost;

int main()

{

string str = "33333333333";

unsigned long long int num = lexical_cast<unsigned long long int>(str);     // 如果是 unsigned int 就会抛异常的

cout<<num<<endl;

return 0;

}

非常赞!

2:

posted @ 2011-10-15 01:02  王帅901  阅读(181)  评论(0编辑  收藏  举报