什么样的运营商"不是","和"和"或"在C ++中

时间:2016-04-26 13:39:22

标签: c++ operator-overloading operators user-defined

'因为每当我尝试以下其中一行时:

#define and &&
#define or ||
#define not !

我收到错误:

1:9: error: "not"/"and"/"or" cannot be used as a macro name as it is an operator in C++

1 个答案:

答案 0 :(得分:1)

这些关键字已经定义。请看一下http://en.cppreference.com/w/cpp/language/operator_alternative