Boost logo

Boost :

Subject: Re: [boost] [Config] Support for switching between std:: andboost::equivalents.
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-06-06 23:17:04


On 6/6/2015 7:21 PM, Peter Dimov wrote:
> Edward Diener wrote:
>
>> That use case does not currently exist. But I am missing your point.
>
> That was my point. The use case doesn't exist yet.
>
> You were obviously motivated by something to propose the macros, and I
> was wondering what that something was. Did you actually have a use case,
> or was that in anticipation of what the future will bring.
>
> It appears that it's the latter, in which case, I'm still interested in
> your anticipated future use case.

The use case is that I support/use the C++ standard library equivalents
to Boost libraries in C++11 mode and I support/use the Boost libraries
in C++03 mode. That should make it easier for my library's code to work
with what the user of my library will most likely use in his own code.

I design a library which, let's say, takes a regex object as parameter
to some exported function. If the end-user of my library is compiling in
C++11 mode is it more likely that his use of regex will be std::regex or
boost::regex ? IMO it is the former. Conversely if the end-user of my
library is compiling in C++03 mode is it more likely that his use of
regex will be std::regex or boost::regex ? That's a loaded question of
course because std::regex won't be available to him if he compiles in
C++03 mode. So my preferred usage of regex in my library, all else being
equal, is to use boost::regex in C++03 mode and std::regex in C++11 mode.

Even if Boost is a single distribution as it is now, so that
boost::regex is always available for my Boost library I think it is
advantageous to use the scheme just described.

>
>> The mechanism says that if std::regex exists, use it instead of
>> boost::regex. If std::regex does not exist use boost::regex instead.
>> If I don't have a dependency on boost::regex and std::regex supplies
>> all my module's needs is it not better to use std::regex, so that in a
>> future modular Boost distribution based system I will not have to
>> distribute boost::regex with my library ?
>
> So your anticipated future use case is that you want to create a
> distribution for your library that contains Boost.Config but does not
> contain Boost.Regex?

Yes, for C++11 mode.

>
>> There is some sort of disconnect here, because I can't make out what
>> you are getting at.
>
> You're putting the cart before the horse (Cartesius ante equum, as they
> say). The modular future hasn't arrived yet and we have no idea what it
> will be.

You are right. But I don't think it is unreasonable to consider that if
it does arrive so that individual Boost libraries with their
dependencies are distributed separately from the complete Boost tree as
we do now, the elimination of dependencies for a particular distribution
of a library is a good thing as long as it does not compromise the
quality of the code.

>
>> Somebody, I forget who, wrote a Boost tool for extracting a library
>> and its dependencies into a sort of mini-distribution.
>
> John Maddock, the tool is called bcp.

I was kidding and referring to your bpm tool.


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