boost 高級功能

1.判斷路徑存在,如果不存在則創建

if ( !boost::filesystem::exists(path)) {
       boost::filesystem::create_directories(path) ;
}

2.格式化參數

_moveCmd = boost::format( "4,%1%,%2%,%3%,%4%,%5%,%6%," ) ;
_moveCmd % axle.a1 % axle.a2 % axle.a3 % axle.a4 % axle.a5 % axle.a6 ;

2.1切割字符串

#include <boost/format.hpp>
https://blog.csdn.net/huang_xw/article/details/8449045

 

3.時間

#include <boost/date_time/posix_time/posix_time.hpp>


auto t = boost::posix_time::microsec_clock::local_time() ;
std::string strTime = boost::posix_time::to_iso_string(t_now);

4.boost序列化--類似於Google Protobuff

  • 可以序列化STL對象
  • 可以序列化自己構造的結構-入侵時和非入侵式(與要定義的序列化模板函數有關)
https://www.ibm.com/developerworks/cn/aix/library/au-boostserialization/

5.boost lambd

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