A recent addition std::byte
in C ++ 17 made me wonder why this type was even added to the standard at all. Even after reading the cppreference link , this use of cases does not seem clear to me.
The only use case that I can come up with is that it expresses the intention more clearly, since std::byte
it should be considered only as a set of bits instead of the type of character, such as char
that which we used for both purposes before, This means that:
std::vector<std::byte> memory;
Clearer than this:
std::vector<char> memory;
Is this the only use case and the reason it was added to the standard, or I don’t see a big point here?
source
share