std::byte

Defined in <cstddef>

Avaiable from C++17

Like char and unsigned char, it can be used to access raw memory occupied by other objects (object representation), but unlike those types, it is not a character type and is not an arithmetic type. A byte is only a collection of bits, and only bitwise operators are defined for it.

Usage:

std::byte b{42};
b |= std::byte{0b11110000};

So you can represent a dynamic region of raw memory as:

std::vector<std::byte>