Following sample project created by qt creator and contains following files:
TEMPLATE = app CONFIG += console SOURCES += main.cpp INCLUDEPATH += /home/tufan/boost_1_55_0Boost header files and libraries are located under the directory : /home/tufan/boost_1_55_0
main.cpp file contains main method.
#include <boost/array.hpp> #include <string.h> using namespace std; int main() { typedef boost::array<string,3> boostArray; boostArray stringArray; stringArray[0] = "FirstStringMember"; stringArray.at(1) = "SecondStringMember"; stringArray.at(2) = "ThirdStringMember"; // some common container operations cout << "size: " << stringArray.size() << endl; cout << "empty: " << boolalpha << stringArray.empty() << endl; cout << "front: " << stringArray.front() << endl; cout << "back: " << stringArray.back() << endl; cout << "elements: " << endl; for(boostArray::iterator iter(stringArray.begin()); iter != stringArray.end(); ++iter) { cout << *iter << endl; } return 0; }boost array contains 3 string items. Members of the array are initialized by using array subscript operator and at() function.
size: 3
empty: false
front: FirstStringMember
back: ThirdStringMember
elements:
FirstStringMember
SecondStringMember
ThirdStringMember