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


 

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