Compile-time construction of byte arrays.
|
| template<typename B = std::byte, typename... Args> |
| PW_CONSTEVAL auto | pw::bytes::Concat (Args... args) |
| |
|
template<typename B = std::byte, size_t kSize, typename Indices = std::make_index_sequence<kSize - 1>> |
| PW_CONSTEVAL auto | pw::bytes::String (const char(&str)[kSize]) |
| | Converts a string literal to an array of bytes, without the trailing '\0'.
|
| |
|
template<typename B = std::byte> |
| PW_CONSTEVAL auto | pw::bytes::String (const char(&)[1]) |
| | String overload for the empty string "".
|
| |
| template<typename B , auto... values> |
| PW_CONSTEVAL auto | pw::bytes::Array () |
| |
|
template<auto... values> |
| PW_CONSTEVAL auto | pw::bytes::Array () |
| | Array() defaults to using std::byte.
|
| |
| template<typename B , size_t kSize, typename T > |
| constexpr auto | pw::bytes::Initialized (const T &value_or_function) |
| |
|
template<size_t kSize, typename T > |
| constexpr auto | pw::bytes::Initialized (const T &value_or_function) |
| | Initialized(value_or_function) defaults to using std::byte.
|
| |
| template<typename B = std::byte, typename... Args> |
| constexpr auto | pw::bytes::MakeArray (const Args &... args) |
| |
◆ Array()
template<typename B , auto... values>
Creates an array of bytes from values passed as template parameters. The values are guaranteed to be representable in the destination byte type.
◆ Concat()
template<typename B = std::byte, typename... Args>
Concatenates arrays or integers as a byte array at compile time. Integer values are copied little-endian. Spans are copied byte-for-byte.
◆ Initialized()
template<typename B , size_t kSize, typename T >
| constexpr auto pw::bytes::Initialized |
( |
const T & |
value_or_function | ) |
|
|
constexpr |
Creates an initialized array of bytes. Initializes the array to a value or the return values from a function that accepts the index as a parameter.
◆ MakeArray()
template<typename B = std::byte, typename... Args>
| constexpr auto pw::bytes::MakeArray |
( |
const Args &... |
args | ) |
|
|
constexpr |
Creates an array of bytes from a series of function arguments. Unlike Array(), MakeArray() cannot check if the values fit in the destination type. MakeArray() should only be used when Array() is not suitable.