C++ 笔记 boost::lexical_cast数据类型转换器

lexical_cast是boost库中提供的数据类型转换器,用法如下:

#include <boost/lexical_cast.hpp>

    string s = "123";  
    int a = lexical_cast<int>(s); 

 lexical_cast的原型如下:

template<typename Target, typename Source> 
    Target lexical_cast(Source arg); 

参考资料:

http://www.mamicode.com/info-detail-365012.html

https://blog.csdn.net/weixin_34352449/article/details/85725856?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task


 

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章