boostorg / config

Boost.org config module
http://boost.org/libs/config
72 stars 154 forks source link

There should be a BOOST_IF_CONSTEXPR macro #305

Closed rubenvb closed 4 years ago

rubenvb commented 4 years ago

This would expand to if constexpr where available, and plain if where it's not.

This can help write "correct" code and suppress warnings when doing plain if on compile-time constants such as trait expressions.

An example of this is found here: https://github.com/boostorg/spirit/blob/develop/include/boost/spirit/home/x3/char/detail/cast_char.hpp#L33

Having this macro prevents further (verbose) proliferation of locally disabling the warning.

jzmaddock commented 4 years ago

Done