Alternative operator representations

From Cppreference

Jump to: navigation, search

There are alternative spellings for several operators defined as keywords in the C++ standard.

Primary Alternative
&& and
&= and_eq
& bitand
| bitor
~ compl
! not
!= not_eq
|| or
|= or_eq
^ xor
^= xor_eq

In addition to those alternative tokens, the following digraphs are valid substitutions:

Primary Alternative
{ <%
} %>
[ <:
] :>
# %:
## %:%:

[edit] Keywords

and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq

[edit] Example

The following example demonstrates the use of several alternative keywords:

%:include <iostream>
 
int main(int argc, char *argv<::>) 
<%
    if (argc > 1 and argv<:1:> not_eq '\0') <%
        std::cout << "Hello " << argv<:1:> << '\n';
    %>
%>