cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Implements the backport for std::byte
.
More...
Public Member Functions | |
operator unsigned char () const noexcept | |
Explicit conversion to unsigned char (implementation-defined). | |
Public Attributes | |
__implementation_defined_t | value |
Stored value corresponding to one "byte" (implementation-defined). | |
Implements the backport for std::byte
.
This implementation-defined struct implements the functionality for std::byte
where required (eg.: in C++03 mode).
In general, a byte
is structured as follows:
Only comparison operator, bit operations (via bitmask operators) and explicit conversion to unsigned char
are defined for it. Just like std::byte
, it has no value-taking constructors.
The implementation changes according to the language features that cxxomfort can find. In C++11 onwards mode, an actual enum class
is used.
In general, the following operations are allowed on a byte
:
Except where explicitly indicated, all operations on byte
are nothrow and (C++14) constexpr, including conversions to integrals.
The helper function to_byte()
is used to construct a byte
pre-C++17.
The helper functions to_integer()
and to_value()
can recover the value stored by a byte
into an integral or unsigned char
variable respectively.
If cxxomfort has to activate this backport, the SD6 macro __cpp_lib_byte
is defined.
See std::byte
for more information.