Boost logo

Boost :

Subject: Re: [boost] Some statistics about the C++ 11/14 mandatoryBoostlibraries
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-15 13:29:22


Niall Douglas wrote:

> > > APIBind enables you to bind a copy of function<> into your library's
> > > namespace e.g.
> > >
> > > namespace boost { namespace foo { template<class R, class... Args>
> > > using function = std::function<R(Args...)>; } }

...

> Indeed, APIBind is there to ensure that your library X built against
> boost::function doesn't collide with your library X build against
> std::function in the same translation unit.

Does this actually work? Because I've trouble visualizing it based on this
description.

OK, X built against boost::function has

namespace boost { namespace foo {

template<class R, class... Args>
using function = boost::function<R(Args...)>;

} }

and X built against std::function has

namespace boost { namespace foo {

template<class R, class... Args>
using function = std::function<R(Args...)>;

} }

Why do those two not clash? I'm not seeing it. Perhaps the two 'foo'
namespaces are actually different?

But if so, does this not lead to a combinatorial explosion when more than
one component can use either its Boost or standard version? function, bind,
shared_ptr, regex... that's 16 combinations so far.


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