Boost logo

Boost :

Subject: Re: [boost] C++17 detection
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2017-09-11 15:20:48


On Monday, September 11, 2017, Robert Ramey wrote:

> On 9/10/17 12:07 PM, Glen Fernandes via Boost wrote:
>
>> On Sun, Sep 10, 2017 at 1:30 PM, Robert Ramey wrote:
>>
>>> #if C++14 being used
>>> namespace std {
>>> // implement C++ function
>>> }
>>>
>>
>> Don't define those things inside namespace std. Instead:
>>
>
> Hmmmm - I've done this from time to time. Why would this be a bad thing?

Because we only define things inside std that we are explicitly granted
permission to (such as specializations of specific stand library types).

> #if /* C++17 thing available */
>>
>
> Actually, the question I meant to ask is what should go into the
>
> /* C++17 thing available */
>
> I was thinking of something from Boost.Config - which I use a lot.

Yes. You should add BOOST_NO_CXX17_STD_IS_DETECTED or similar to
Boost.Config, just as we have added similar C++17 feature detection macros
recently (e.g
BOOST_NO_CXX17_FOLD_EXPRESSIONS, for Peter to use in Boost.Mp11).

We want to have these detections handled in one place that all Boost
libraries can benefit from. Implementation vendors don't always define
__cplusplus to a value that sensibly or accurately reflect the state of
their conformance. Then there could be defects in their implementations
that otherwise invalidate what conformance they advertised. Boost.Config is
the thing we rely on to tell us otherwise.

Glen


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