I don’t think you need a “constexpr_if.” You can unconditionally put BOOST_CONSTEXPR in the definition. This will unconditionally add “constexpr” to the member operator (for C++11 systems), which will be ignored if the compiler determines that the attached function (or a particular call) is disqualified from being used in constant expressions. So any extra preprocessor work, or a variant macro, is unnecessary. Sent from Windows Mail From: Andrey Semashev Sent: Sunday, September 01, 2013 4:40 AM To: boost@lists.boost.org On Sunday 01 September 2013 03:27:06 Daryle Walker wrote:
Date: Wed, 28 Aug 2013 12:14:51 +0400 From: andrey.semashev@gmail.com
1. BOOST_EXPLICIT_OPERATOR_BOOL() macro for defining explicit operator bool() for a class.
a. It isn't marked "constexpr." I can add that myself before using "BOOST_EXPLICIT_OPERATOR_BOOL" in "boost/rational.hpp," but what happens if someone corrects it in "explicit_operator_bool.hpp"? Will the (temporary) double definition cause an error?
Well, since there isn't a constexpr_if or something, I don't see a way to add it to BOOST_EXPLICIT_OPERATOR_BOOL. I could add BOOST_EXPLICIT_OPERATOR_BOOL_PP(pre, post), which would add pre() and post() before and after the operator signature. For example: