Boost logo

Boost :

Subject: Re: [boost] [Config] Support for switching between std:: and boost:: equivalents.
From: Rob Stewart (rob.stewart_at_[hidden])
Date: 2015-06-05 10:00:42


On June 5, 2015 5:30:03 AM EDT, Edward Diener <eldiener_at_[hidden]> wrote:
> On 6/5/2015 3:41 AM, John Maddock wrote:
> > There is a pull-request for Config to provide support for switching
> > between boost:: and std:: library equivalents:
> > https://github.com/boostorg/config/pull/63
> >
> > My questions are:
> >
> > * Is this the right approach? And,
> > * Is Boost.Config the right place for it?
>
> I don't know what "the right approach" would be but this is one
> approach that does work easily.

It does seem like a reasonable approach overall. It's relatively simple and doesn't try to hide much.

I can't think of a better place for this than Config.

> It is very easy to use. For library 'XXX':
>
> 1) Just include the particular Boost.config header provided for a
> particular interoperable library XXX:
>
> #include <boost/config/cpp/XXX.hpp>

I noticed in your PR that you also provide a header to get all such headers at once. I wonder whether the individual headers are really that useful. You could keep the implementation you have, but just document the one header.

> 2) Include that library's main header file using the macro provided
> for that library:
>
> #include BOOST_CPP_XXX_HDR

Why do you have "CPP" in that name? BOOST_XXX_HDR would seem sufficient. I also would suggest using HEADER rather than HDR.

> 3) In code for that library's functionality use the namespace macro
> provided for accessing the library's functionality:
> BOOST_CPP_XXX_NS::some_functionality etc.

Why do you have "CPP" in that name? BOOST_XXX_NS would seem sufficient.

> If you need to do anything different depending on whether you are
> using
> the C++ standard version of the library or the Boost version of the
> library you can test the BOOST_CPP_HAS_XXX macro, which is 1 for the
> C++
> standard version existing in the compiler implementation and is 0 for
> only the Boost version existing in the compiler implementation.

That macro would seem better named, BOOST_HAS_STD_XXX our BOOST_XXX_IS_STD. (The latter is more consistent with my earlier suggestions.)

___
Rob

(Sent from my portable computation engine)


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