C++ keyword: or_eq - cppreference.com

From cppreference.com

Usage

alternative operators

: as an alternative for |=

Example

Run this code

#include<bitset>#include<iostream>usingbin=std::bitset<8>;voidshow(binz,constchar*s,intn){if(n==0)std::cout<<"┌───────────┬──────────┐\n";if(n<=2)std::cout<<"│ "<<s<<" │ "<<z<<" │\n";if(n==2)std::cout<<"└───────────┴──────────┘\n";}intmain(){binx{"01011010"};show(x,"x ",0);biny{"00111100"};show(y,"y ",1);xor_eqy;show(x,"x or_eq y",2);}Output:

┌───────────┬──────────┐ │ x │ 01011010 │ │ y │ 00111100 │ │ x or_eq y │ 01111110 │ └───────────┴──────────┘ See also

and

,

and_eq

bitand

,

bitor

not

,

not_eq

or

xor

,

xor_eq