Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Boost 1.61 Brings New Libraries for CPU/CPU Computation, Plugin Management, and More

Boost 1.61 Brings New Libraries for CPU/CPU Computation, Plugin Management, and More

Five months after the introduction of version 1.60, Boost hits version 1.61, adding several new libraries and updating many more.

Boost 1.61 includes four new libraries:

  • Compute, a library providing a C++ interface to multi-core CPU and GPU computing platforms using OpenCL. OpenCL is an open standard enabling the creation of programs that run on a heterogeneous set of compute devices, such as CPUs and GPUs. The library provides classes to manage OpenCL objects such as device, kernel, and command_queues, and functions that allow developers to handle compute devices, transfer data to and from it, and iterate/transform it. This is how you could transfer data to the default compute device, transform it, and then copy it back:
        std::vector<float> host_vector(10000);
        // define host_vector content
        // get default device and setup context
        compute::device device = compute::system::default_device();
        compute::context context(device);
        compute::command_queue queue(context, device);
        // create a vector on the device
        compute::vector<float> device_vector(host_vector.size(), context);
        // transfer data from the host to the device
            host_vector.begin(), host_vector.end(), device_vector.begin(), queue
        // calculate the square-root of each element in-place
        // copy values back to the host
            device_vector.begin(), device_vector.end(), host_vector.begin(), queue
  • DLL, a library aimed at enabling the development of cross-platforms, portable plugins. DLL allows developers to load libraries and import native functions and variables, query libraries for sections and symbols, etc. DLL plugins can be defined using the extern “C” and BOOST_SYMBOL_EXPORT. A client program can load a DLL plugin by executing import:
        // variable to hold a pointer to plugin variable
        boost::shared_ptr<my_plugin_api> plugin;
        plugin = dll::import<my_plugin_api>(

    DLL also supports library reference counting to better control the lifetime of a loaded plugin, callback execution on plugin unload and more.

  • Hana, a metaprogramming library that provides high level algorithms to manipulate heterogeneous sequences. In contrast to preexisting metaprogramming libraries such as Boost.MPL and Boost.Fusion, Hana unifies the manipulation of types and values. Hana provides a number of container types, such as tuple, optional, map, etc., and a collection of algorithms that work on them, such as fold, zip, flatten, etc.

  • Metaparse, a library to generate parsers that parse text or code at compile time and return a type, a constant value, a C++ function to be called at runtime, etc. Metaparse is specifically intended for embedded domain specific language creation. Metaparse enables the defintion of context free grammars using an EBNF-like syntax. The main differentiator between Metaparse and Boost.Spirit, a well-known metaprogramming library, is that the latter produces run-time parsers, while Metaparse produces compile-time parsers.

As mentioned, Boost 1.61 also updates many existing libraries, including Multiprecision, Optional, Geometry, and Fusion, among others.

Rate this Article