Boost

Boost provides free peer-reviewed portable C++ source libraries [1]. The boost installation on the HPC has been built with MPI support. Most often, boost will be used to fulfill a dependency while building a software package, which only requires loading the module as described below. A short example C++ program that uses boost directly is also provided.

Module

List the versions available as modules:

module spider boost

Output:

--------------------------

  boost/1.63.0

--------------------------

...

See how to load the version you need:

module spider boost/<version>

Load any required modules that are reported by the spider command, and then load the boost module:

module load boost/<version>

Example Program

The following short program adapted from the boost documentation [2], shows how to use boost in C++ source code:

#include <boost/lambda/lambda.hpp>

#include <iostream>

#include <iterator>

#include <algorithm>


int main()

{

    using namespace boost::lambda;

    typedef std::istream_iterator<int> in;


    std::for_each(

        in(std::cin), in(), std::cout << (_1 * 3) << " " );

    std::cout << "\n";

}

After loading the boost module as described in the first section and adding the above source to a file "example.cpp" it can be compiled as:

g++ example.cpp -o example

References