Looking at boost 1.77
published at 18.08.2021 16:05 by Jens Weller
Last week a new boost version was released. Unlike the last version, 1.77 contains again two new and interesting libraries: Describe and Lambda2, which both are based on C++14.
This library lets you literally describe your class, struct or enum via BOOST_DESCRIBE_CLASS/STRUCT/ENUM makros, so that it then can generate the needed code to offer access to it. The library uses boost::mp11 for the ways to describe the types and typelists, and can be used in combination with this library to easily work with the information gathered through the BOOST_DESCRIBE macros.
Simple usage examples include string-to-enum (and the other way around) or converting to/from JSON. Up to 52 members can be described, the library does not support anonymous unions, bitfields and reference members.
This library is a modern take on what boost::lambda offers. Though its a much leaner and cleaner implementation based on C++14 and std::bind and its customization points and the corresponding function objects in the standard like std::plus. The library lets you build an expression which then at the end will result in a function object being called. Its a dependency free, header only library.
The library allows to write code that is more readable when using standard algorithms like std::find_if(c.begin(),c.end(),_1 % 2 ==0) for counting the even entries of a container.
Changes and updates to existing boost libraries
Like with every new version, boost adds a ton of fixes and improvements.
This version adds lots of changes to Boost::Asio: a cancellation handler for individual asynchronous operations. The ability to have multiple signatures for completion handlers. Asio also adds a few more types to its experimental namespace, including support for parallel_groups, allowing to group async operations and set the completion handling to wait_for_all, wait_for_one, wait_for_one_success, wait_for_one_error or a custom completion handler. Plus some minor fixes and improvements.
Also there is now v4 of Boost::Filesystem available with this release. It removes all deprecated features of v3 and is a breaking change to make its API more compatible with std::filesystem. Though this release is not setting v4 as the default - v3 is still the default - but you can upgrade via the version macro to 4. One can use both versions from the same binary without recompilation, but should not mix them in code. Also as this is the first release of v4, its not 100% stable and will see changes in future releases. Again, lots of fixes and minor changes and additions to this library over all. Some are improvements for specific platforms.
Boost::Json fixed allocation errors in the object and key_value_pair types, plus an actual crash when constructing an array from a pair of iterators that form an empty range.
Join the Meeting C++ patreon community!
This and other posts on Meeting C++ are enabled by my supporters on patreon!