&= and |=

http://www.cplusplus.com/reference/iostream/ios_base/fmtflags/

1
2
3
 ff &= ~cout.basefield;   // unset basefield bits
  ff |= cout.hex;          // set hex
  ff |= cout.showbase;     // set showbase 


what with &= and |= what do they mean ?
They're the compound assignment variants of & and |.
some simple example would be greatly appreciated
1
2
3
a |= b; a or_eq b; a = a bitor b;
a &= b; a and_eq b; a = a bitand b
~a; compl a;


Where bit(op) is the 'op' aplied bit to bit.
x&=y; does the same as x=x&y;, as with all compound assignment operators.
See http://www.cplusplus.com/doc/tutorial/operators/
Topic archived. No new replies allowed.