Alternative Representations of Bitwise Operators

C++ provides alternative representations of several bitwise operators, as shown in Table E.4. They are provided for locales that do not have the traditional bitwise operators as part of their character sets.

Table E.4. Bitwise Operator Representations

Image

These alternative forms let you write statements like the following:

b = compl a bitand b;  // same as b = ~a & b;c = a xor b;           // same as c = a ^ c;

Get C++ Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.