# C++ keyword: `bitor`

From cppreference.com
< cpp‎ | keyword

### Usage

- alternative operators: as an alternative for `|`

### Example

Run this code

    #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 bitor y; show(z, "x bitor y", 2);
    }

Output:

    ┌───────────┬──────────┐
    │ x         │ 01011010 │
    │ y         │ 00111100 │
    │ x bitor y │ 01111110 │
    └───────────┴──────────┘

### See also

- `and`, `and_eq`
- `bitand`
- `not`, `not_eq`
- `or`, `or_eq`
- `xor`, `xor_eq`

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/keyword/bitor&oldid=175669"