|
Boost : |
Subject: Re: [boost] Some statistics about the C++ 11/14 mandatory Boostlibraries
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-05-14 20:29:42
On 14 May 2015 at 16:23, Emil Dotchevski wrote:
> > No, I'm saying it's up to the maintainer to maintain their library. I
> > believe that means making it able to use as much STL11 as possible if
> > they want to keep it fresh and relevant. Or else they completely
> > rewrite it in C++ 11/14. I don't mind which.
> >
>
> Are you saying that if a Boost library uses boost::function, it's up to
> that library's author to make it able to use std::function instead?
Yes. Maybe with a macro set by the user such as
BOOST_XXX_USE_BOOST_FUNCTION=1.
> I think that if the option is available at all it should be up to
> boost::function to map to std::function, but other Boost libraries would
> still #include "boost/function.hpp" and refer to it as boost::function.
The problem with that is almost certainly some libraries will need
refactoring to support std::function. It's not always a clean swap,
especially if boost::function extensions are used (even if not
necessary).
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...)>; } }
You obviously wouldn't define that except when building under C++ 11
with std function enabled. function<> then resolves to either std
function or boost function as configured. Your library code is
unchanged, and doesn't care what the implementation is.
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk