|
Boost : |
Subject: Re: [boost] C++17 detection
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2017-09-11 16:43:54
On 11/09/2017 16:58, Robert Ramey via Boost wrote:
> On 9/10/17 12:07 PM, Glen Fernandes via Boost wrote:
>> On Sun, Sep 10, 2017 at 1:30 PM, Robert Ramey via Boost wrote:
>>> How do I get ready for C++17?
>>>
>>> I have a piece of code which requires C++14. I want to use something
>>> from
>>> C++17 but I also want my code to work now. So I have
>>>
>>> #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 it can fail. Newer stdlib implementations use inline namespaces
so you just can't forward declare things in namespace std. You need more
elaborated tricks:
http://www.boost.org/doc/libs/1_65_1/boost/move/detail/std_ns_begin.hpp
http://www.boost.org/doc/libs/1_65_1/boost/move/detail/std_ns_end.hpp
A Boost.Config or similar library that does this would be useful. That
way we could forward declare standard classes instead of pulling the
whole header.
Best,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk