Whats new in boost 1.59?

published at 14.08.2015 18:31 by Jens Weller

Yesterday the next version of boost, 1.59 has been released. This time 2 new libraries but also the release of boost::test v3 makes this a very interesting release. A very good starting point for using boost is the (online) book of Boris Schäling: The boost C++ libraries. Missing from this release are still a few libraries which got accepted into boost this year, e.g. boost.compute and boost.hana. But lets have a look at the new libraries, Convert and Coroutine2, plus boost::test v3.

Convert

This library is about conversion between types and different representation, mainly a more flexible version of boost::lexical_cast. Yet it takes a few different approaches, and is there fore not an extension of boost::lexical_cast. Types need not to be default constructable, the library does not throw on failed conversions, offers support for locales and formatting. The error reporting can be influenced by the user. Currently the library offers 5 different, exchangeable converter back ends to be used with boost::convert:

The documentation also offers an overview on performance.

Coroutine2

This library offers a C++14 implementation for coroutines, it is build upon boost.context. The documentation offers a very good introduction into coroutines and how they can improve your code.

Test v3

This 3rd version of boost::test offers a few new features, such as data driven tests, where the following code

void single_test( int i )
{
  BOOST_TEST( /* test assertion */ );
}

void combined_test()
{
  int params[] = { 1, 2, 3, 4, 5 };
  std::for_each( params, params+5, &single_test );
}

Could be replaced with the new BOOST_DATA_TEST_CASE Macro. Also new is, that with BOOST_TEST now exists a generic and general purpose assertion.