#define QL_REQUIRE(condition,message) \
if (!(condition)) { \
std::ostringstream _ql_msg_stream; \
_ql_msg_stream << message; \
throw QuantLib::Error(__FILE__,__LINE__, \
BOOST_CURRENT_FUNCTION,_ql_msg_stream.str()); \
} else
如何使用它:
void testingMacros1 (){
double x =0.0;
QL_REQUIRE (x!=0 ," Zero number !");
}
为什么宏最后会注入a else
?