Library: Input/output
A Bitmask type is an integer type, including an enumerated type or an assignable, copy constructible, and equality comparable class type, for which the following bitwise operators are defined:
T operator & (T, T)
T operator | (T, T)
T operator ^ (T, T)
T operator ~ (T)
T& operator &= (T)
T& operator |= (T)
T& operator ^= (T)
Distinct values of a bitmask type such that for any pair Ci and Cj, (Ci & Ci) != T() and (Ci & Cj) == T(), are elements of the bitmask type. Informally speaking, no two elements of a bitmask type have any overlapping bits.
To set a value Y in an object X of a bitmask type is to evaluate the expression: X = Y.
To clear a value Y in an object X of a bitmask type is to evaluate the expression: X &= ~Y.
To clear all bits of an object X of a bitmask type is to evaluate the expression: X ^= X.
The value Y is set in the object X of a bitmask type T if and only if the expression (X & Y) != T () evaluates to true.
Note that since a bitmask type need not be implemented as an integer type, there may not be an implicit conversion from an integer type to a bitmask type. Specifically, assigning any integer to a bitmask type need not be well-formed and may cause compilation errors. In order to initialize an object X of a bitmask type T to have none of its bits set, the object should be initialized as follows: T X = T () (not T X = 0).
ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Library Introduction, Section 17.3.2.1.2.