(C++) operator|

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) operator|

 

operator| (pronounces as 'bitwise or operator') is an operator to perform bitwise or operations. The example below shows how to reconstruct a truth table:

 


#include <iostream> int main() {   const bool f = false;   const bool t = true;   std::cout     << (f | f) << '\n'  //0     << (f | t) << '\n'  //1     << (t | f) << '\n'  //1     << (t | t) << '\n'; //1 }