cxxomfort  rel.20210622
Simple backports for C++ - http://ryan.gulix.cl/fossil.cgi/cxxomfort/
Files | Typedefs
Std0cstddef

Files

file  cstddef.hpp
 Implementations and additions tied to Standard header cstddef.
 

Typedefs

typedef long double max_align_t
 Alias for the native type with the largest alignment available. More...
 

Detailed Description

See also
http://wg21.link/p0298r3
https://en.cppreference.com/w/cpp/types/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:

enum class byte : unsigned char {};
unsigned to_integral (byte); // implementation_defined
byte b = to_byte('c');
unsigned char uc = explicit_cast<unsigned char>(b);

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 :

byte b = to_byte(0xnn);
b | c;
b & c;
b ^ c;
b >>= 2;
c <<= 3;
c= ~b;
int cint = to_integer<int>(c);
byte d { 0x23 }; // c++17 only

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.

See std::byte for more information.

Typedef Documentation

◆ max_align_t

Alias for the native type with the largest alignment available.

See also
https://en.cppreference.com/w/cpp/types/max_align_t Alias for the native type with the largest alignment available.