muu::literals namespace inline

Literal operators.

Functions

auto operator""_b(unsigned long long b) -> size_t consteval noexcept
Creates a size_t for a given number of bytes.
auto operator""_f16(long double val) -> half consteval noexcept
Literal for creating a half-precision float.
auto operator""_f16(unsigned long long val) -> half consteval noexcept
Literal for creating a half-precision float.
template <impl::fixed_string_udl_impl Str>
auto operator""_fs() consteval
Constructs a fixed_string directly using a string literal.
auto operator""_gb(unsigned long long gb) -> size_t consteval noexcept
Creates a size_t for a given number of gigabytes.
auto operator""_i128(unsigned long long n) -> int128_t consteval noexcept
Creates an int128_t.
auto operator""_i16(unsigned long long n) -> int16_t consteval noexcept
Creates an int16_t.
auto operator""_i32(unsigned long long n) -> int32_t consteval noexcept
Creates an int32_t.
auto operator""_i64(unsigned long long n) -> int64_t consteval noexcept
Creates an int64_t.
auto operator""_i8(unsigned long long n) -> int8_t consteval noexcept
Creates an int8_t.
auto operator""_kb(unsigned long long kb) -> size_t consteval noexcept
Creates a size_t for a given number of kilobytes.
auto operator""_mb(unsigned long long mb) -> size_t consteval noexcept
Creates a size_t for a given number of megabytes.
auto operator""_sz(unsigned long long n) -> size_t consteval noexcept
Creates a size_t.
auto operator""_u128(unsigned long long n) -> uint128_t consteval noexcept
Creates a uint128_t.
auto operator""_u16(unsigned long long n) -> uint16_t consteval noexcept
Creates a uint16_t.
auto operator""_u32(unsigned long long n) -> uint32_t consteval noexcept
Creates a uint32_t.
auto operator""_u64(unsigned long long n) -> uint64_t consteval noexcept
Creates a uint64_t.
auto operator""_u8(unsigned long long n) -> uint8_t consteval noexcept
Creates a uint8_t.
auto operator""_uuid(const char* str, size_t len) -> uuid consteval noexcept
Constructs a uuid from a string literal using uuid::parse.

Function documentation

size_t muu::literals::operator""_b(unsigned long long b) consteval noexcept

Creates a size_t for a given number of bytes.

const size_t val = 42_b; // 42

half muu::literals::operator""_f16(long double val) consteval noexcept
#include <muu/half.h>

Literal for creating a half-precision float.

const half val = 42.5_f16;

half muu::literals::operator""_f16(unsigned long long val) consteval noexcept
#include <muu/half.h>

Literal for creating a half-precision float.

const half val = 42_f16;

template <impl::fixed_string_udl_impl Str>
auto muu::literals::operator""_fs() consteval

Constructs a fixed_string directly using a string literal.

constexpr auto str = "hello"_fs;
static_assert(str == fixed_string{ "hello" })

size_t muu::literals::operator""_gb(unsigned long long gb) consteval noexcept

Creates a size_t for a given number of gigabytes.

const size_t val = 42_gb; // 42 * 1024 * 1024 * 1024

int128_t muu::literals::operator""_i128(unsigned long long n) consteval noexcept

Creates an int128_t.

const int128_t val = 42_i128;

int16_t muu::literals::operator""_i16(unsigned long long n) consteval noexcept

Creates an int16_t.

const int16_t val = 42_i16;

int32_t muu::literals::operator""_i32(unsigned long long n) consteval noexcept

Creates an int32_t.

const int32_t val = 42_i32;

int64_t muu::literals::operator""_i64(unsigned long long n) consteval noexcept

Creates an int64_t.

const int64_t val = 42_i64;

int8_t muu::literals::operator""_i8(unsigned long long n) consteval noexcept

Creates an int8_t.

const int8_t val = 42_i8;

size_t muu::literals::operator""_kb(unsigned long long kb) consteval noexcept

Creates a size_t for a given number of kilobytes.

const size_t val = 42_kb; // 42 * 1024

size_t muu::literals::operator""_mb(unsigned long long mb) consteval noexcept

Creates a size_t for a given number of megabytes.

const size_t val = 42_mb; // 42 * 1024 * 1024

size_t muu::literals::operator""_sz(unsigned long long n) consteval noexcept

Creates a size_t.

const size_t val = 42_sz;

uint128_t muu::literals::operator""_u128(unsigned long long n) consteval noexcept

Creates a uint128_t.

const uint128_t val = 42_u128;

uint16_t muu::literals::operator""_u16(unsigned long long n) consteval noexcept

Creates a uint16_t.

const uint16_t val = 42_u16;

uint32_t muu::literals::operator""_u32(unsigned long long n) consteval noexcept

Creates a uint32_t.

const uint32_t val = 42_u32;

uint64_t muu::literals::operator""_u64(unsigned long long n) consteval noexcept

Creates a uint64_t.

const uint64_t val = 42_u64;

uint8_t muu::literals::operator""_u8(unsigned long long n) consteval noexcept

Creates a uint8_t.

const uint8_t val = 42_u8;

uuid muu::literals::operator""_uuid(const char* str, size_t len) consteval noexcept
#include <muu/uuid.h>

Constructs a uuid from a string literal using uuid::parse.

const uuid id = "{06B35EFD-A532-4410-ADD1-C8C536C31A84}"_uuid;