C++ keyword: bitand - 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);binz=xbitandy;show(z,"x bitand y",2);}Output:

┌────────────┬──────────┐ │ x │ 01011010 │ │ y │ 00111100 │ │ x bitand y │ 00011000 │ └────────────┴──────────┘ See also

and

,

and_eq

bitor

not

,

not_eq

or

,

or_eq

xor

,

xor_eq