Boost logo

Boost :

Subject: Re: [boost] C++17 detection
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2017-09-10 19:07:12


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:

  namespace boost {
  namespace yours {
  namespace detail {
#if /* C++17 thing available */
      using std::thing;
#else
      /* Define thing yourself */
#endif
  } } }

And then use boost::yours::detail::thing in your library.

Glen


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