Boost logo

Boost :

From: Kostas Savvidis (kotika98_at_[hidden])
Date: 2020-12-01 21:36:34


> On Dec 1, 2020, at 22:05, Antony Polukhin via Boost <boost_at_[hidden]> wrote:
>
>> My alternative idea of "nice to have" is a single Boost library that can
>> use either boost or std components in its interface. That's not always
>> possible to obtain though.
>
> I've tried that and it kind of works. There are still problems:
> * users have to use macro to customize the library
> * bcp still pulls in the Boost alternatives
> * code redability suffers from typedefs
> * you still kind of have two different libraries

Here is a case study. Some while ago I proposed to Steven Watanabe, the maintainer of boost.random
to produce a version of my MIXMAX random number generator for inclusion.
The software at that point was plain vanilla C++11.

After a go-ahead from Steven I added a series of boosticisms in order to make the stuff conform to how things were done in boost.random.
The only sticky point was std:array. I was informed by Steven that the library must work with C++03 and there I had to use boost::array or something else.
Not wanting to use typedefs and macros such as the below,

#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#define mixmaxarray std::array
#else
#include <boost/array.hpp>
#define mixmaxarray boost::array
#endif
...#undef mixmaxarray

The other alternative kindly proposed by Steven was:
namespace boost { namespace random { namespace arrayns = std; } }

And yet another suggestion was to turn off inclusion of MIXMAX under C++03, but that required messing with
[[config.requires cxx11_hdr_array]] in the jamfile for tests which I learned had been a source of problems back in 2016!
http://boost.2283326.n4.nabble.com/question-regarding-quot-requires-cxx11-hdr-array-quot-clause-in-Jamfile-td4690277.html <http://boost.2283326.n4.nabble.com/question-regarding-quot-requires-cxx11-hdr-array-quot-clause-in-Jamfile-td4690277.html>

So, what was the least disruptive solution? Yes, going with boost::array everywhere.

Best Regards,
Kostas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk