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

后端 未结 7 1147
后悔当初
后悔当初 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:23

    From the C++03 standard, section 2.5:

    2.5 Alternative tokens

    Alternative token representations are provided for some operators and punctuators. In all respects of the language, each alternative token behaves the same, respectively, as its primary token, except for its spelling. The set of alternative tokens is defined in Table 2.

    Table 2—alternative tokens

    alternative primary 
      <%         { 
      %>         } 
      <:         [ 
      :>         ] 
      %:         # 
      %:%:       ## 
      and        && 
      bitor      | 
      or         || 
      xor        ˆ 
      compl      ˜ 
      bitand     & 
      and_eq     &= 
      or_eq      |= 
      xor_eq     ˆ= 
      not        ! 
      not_eq     != 
    
    0 讨论(0)
提交回复
热议问题