BOOST库array使用 类似std库的vector


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

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

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

 

 实验代码:

#include 
#include 
#include <string>
#include 

int main(void){

     typedef boost::arraystring, 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

 

 

 

 

 

.