When did “and” become an operator in C++

后端 未结 7 1149
后悔当初
后悔当初 2020-12-05 18:00

I have some code that looks like:

static const std::string and(\" AND \");

This causes an error in g++ like so:

Row.cpp:140         


        
7条回答
  •  离开以前
    2020-12-05 18:17

    According to C++ Standard 2.12 there are predefined preprocessor tokens "which are used in the syntax of the preprocessor or are converted into tokens for operators and punctuators." and is one of them. In new C++ Standard there is new 2.12/2:

    Furthermore, the alternative representations shown in Table 4 for certain operators and punctuators (2.6) are reserved and shall not be used otherwise:

    and and_eq bitand bitor compl not
    not_eq or or_eq xor xor_eq
    

提交回复
热议问题