M
molw5.iwg
Based on my reading of the standard the compiler is free to assume a pointer to
a strongly typed enumeration aliases only other pointers to the same type and
raw character pointers. For example, I would like to define a more restrictive
byte array for interacting with binary data as follows:
enum byte : uint8_t {};
std::vector <byte> buffer;
Specifically, I believe string-like classes could benefit greatly from this
sort of implementation by defining their internal state using definitions
similar to the above:
class string
{
...
private:
enum byte : char {};
std::unique_ptr <byte[]> buffer;
};
The tests I've performed with GCC support the above interpretation – doesa
strict reading of the standard support the above, and/or is there some other
well-known alternative? Thanks in advance,
-molw5
a strongly typed enumeration aliases only other pointers to the same type and
raw character pointers. For example, I would like to define a more restrictive
byte array for interacting with binary data as follows:
enum byte : uint8_t {};
std::vector <byte> buffer;
Specifically, I believe string-like classes could benefit greatly from this
sort of implementation by defining their internal state using definitions
similar to the above:
class string
{
...
private:
enum byte : char {};
std::unique_ptr <byte[]> buffer;
};
The tests I've performed with GCC support the above interpretation – doesa
strict reading of the standard support the above, and/or is there some other
well-known alternative? Thanks in advance,
-molw5