BOOST库的array,  类似std库的vector.

下图所示书籍的下载地址,我的另一篇博客内有记载:

 https://www.cnblogs.com/happybirthdaytoyou/p/13837384.html 

 

 实验代码:

#include <boost/array.hpp>
#include <iostream>
#include <string>
#include <algorithm>

int main(void){

     typedef boost::array<std::string, 3> array; 
     array a; 
     a[0] = "Boris"; 
     a.at(1) = "Anton"; 
     *a.rbegin() = "Caesar"; 

     std::sort(a.begin(), a.end());

     for(array::const_iterator it = a.begin(); it != a.end(); ++it)
    std::cout << *it << std::endl; 

     std::cout << a.size() << std::endl; 
     std::cout << a.max_size() << std::endl;

    return 0;
}

 makefile:

.PHONY: DOIT

DOIT:
    mips-linux-gnu-g++ -I..  my_boost_test.cpp -L../lib  -lboost_thread -lboost_system -o cpp_hello.out  -lrt -lpthread

 

 

 

 

 

 

.

内容来源于网络如有侵权请私信删除
你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!

相关课程

4301 9.8元 98元 1折
4091 9.8元 100元 0.98折