标签:
文件下载:链接:http://pan.baidu.com/s/1kUKaOFP 密码:auf2
解压之后放到你想安装的文件夹内,我的是在C:\Program Files\boost\boost_1_60_0中。
以管理员权限运行cmd,切换到boost目录,运行bootstrap.bat文件,结果如下所示:
结果如下图所示:
配置的目录为:C:\Program Files\boost\boost_1_60_0
配置目录:C:\Program Files\boost\boost_1_60_0\libs
#include <boost/lexical_cast.hpp>
#include <iostream>
using namespace std;
int main()
{
using boost::lexical_cast;
int a = lexical_cast<int>("123");
double b = lexical_cast<double>("123.0123456789");
string s0 = lexical_cast<string>(a);
string s1 = lexical_cast<string>(b);
cout << "number: " << a << " " << b << endl;
cout << "string: " << s0 << " " << s1 << endl;
int c = 0;
try{
c = lexical_cast<int>("abcd");
}
catch (boost::bad_lexical_cast& e){
cout << e.what() << endl;
}
system("Pause");
return 0;
}
标签:
原文地址:http://www.cnblogs.com/sophia-hxw/p/5394748.html