Usage
- alternative operators: as an alternative for
^
Example
#include <bitset>
#include <iostream>
using bin = std::bitset<8>;
void show(bin z, const char* s, int n)
{
if (n == 0) std::cout << "┌─────────┬──────────┐\n";
if (n <= 2) std::cout << "│ "<<s<<" │ " <<z<<" │\n";
if (n == 2) std::cout << "└─────────┴──────────┘\n";
}
int main()
{
bin x{"01011010"}; show(x, "x ", 0);
bin y{"00111100"}; show(y, "y ", 1);
bin z = x xor y; show(z, "x xor y", 2);
}┌─────────┬──────────┐
│ x │ 01011010 │
│ y │ 00111100 │
│ x xor y │ 01100110 │
└─────────┴──────────┘See also
Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.