C++ alternative operators
As a C++ programmer for many years, I never noticed the other style of logic operators in C++ until today.
When I review part of code witten by one of my colleague which is a mainly a Java programmer, and find he uses and other than && in if statement.
And I check cppreference, and find the C++ operator alternative.
Primary | Alternative |
---|---|
&& | and |
&= | and_eq |
& | bitand |
| | bitor |
~ | compl |
! | not |
!= | not_eq |
|| | or |
|= | or_eq |
^ | xor |
^= | xor_eq |
{ | <% |
} | %> |
[ | <: |
] | :> |
# | %: |
## | %:%: |
The reason for alternative operators is that the source code maybe not in ASCII set, and don't have the proper operators.
#cpp #programming #operator