Boost logo

Boost :

Subject: Re: [boost] [config] Positive feature macros, r2
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-25 18:54:13


John Maddock wrote:

> For compilers that are effectively "dead", we could just...

In principle, what I suggest is perfectly doable with negative macros too.
We put

#if !defined(__cpp_foo) || __cpp_foo < 201400
# define BOOST_NO_CXX14_FOO
#endif

in prefix.hpp, then in the compiler-specific configs #undef the macros
instead of setting them. The only reason to prefer positivity is because
this way of doing things is what comes naturally when positive macros are
used.

>From user point of view, I've always felt that

#ifdef BOOST_CXX17_FEATURE

// use c++17 feature

#endif

reads better than the inverted test, but that's probably a matter of taste.
(This also degrades gracefully if one forgets the <config.hpp> include,
which may or may not be considered a feature. :-) )


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