Boost logo

Boost :

Subject: Re: [boost] C++03 / C++11 compatibility question for compiled libraries
From: John Maddock (jz.maddock_at_[hidden])
Date: 2018-02-09 18:45:43

On 08/02/2018 08:50, Raffi Enficiaud via Boost wrote:
> Dear list,
> I have a technical question I do not know how to address, and I would
> like to know how people deal with this.
> To put things in the background: boost.test uses heavily boost::function
> and boost::bind, however I would like to use in some circumstances
> std::function and std::bind, which are, for instance, variadic.

Trying to get back to the case in point... is there any reason not to
support both in the binary library?


virtual int operator()( boost::function<int ()> const& F ) = 0;
virtual int operator()( std::function<int ()> const& F ) = 0;

One of these can presumably simply call the other internally since a
boost::function should be storable in a std::function and vice versa?

Except we can't make the std::function variant virtual as disabling it
in C++03 mode would change the vtable layout... or can we just make sure
it's the last virtual function declared?  Or else maybe only one of
these needs to be virtual and the other can be a one line forwarder?

I don't know enough about Boost.Tests internals to know the answer to
any of these questions, but:

* This topic is going to keep coming up - it may be 03 vs 11 or 14
today, but next week/year it'll be 14 vs 17 or 17 vs 20.  And,
* Somehow we need to find strategies for dealing with this.

Not helping much, John.

This email has been checked for viruses by AVG.

Boost list run by bdawes at, gregod at, cpdaniel at, john at