std::byte
is an abstraction that is supposed to provide a type safe(r) access to regions of memory in C++, starting with the new standard 17. However, it's declared this way according to http://en.cppreference.com/w/cpp/types/byte:
enum class byte : unsigned char {} ;
That is, it is an enum class
without any enumerations. Since usually the purpose of enums
is to provide a restricted set of enumerations, this seems a bit strange. A class with a private unsigned char
member seems like the more obvious way to do this.
Why is it done this way?