Skip to content

Engine → Core → uuid.h

uuid

Syntax

class CONJURE_API uuid

Constructors

AccessSignatureDescription
publicconstexpr uuid() noexcept = default;
publicconstexpr uuid( u64 high, u64 low) noexcept;Builds an identifier from its two 64-bit halves (most significant first).

Variables

AccessNameTypeDefaultDescription
privatemHighu640
privatemLowu640

Functions

Public

generate

[[nodiscard]] static uuid generate();

Generates a random version-4 identifier. Thread-safe. The per-thread generator is seeded from std::random_device on first use; a host without an entropy source terminates there, which is acceptable for every supported desktop platform.

hash

[[nodiscard]] constexpr u64 hash() const noexcept;

64-bit hash suitable for hash maps.

high

[[nodiscard]] constexpr u64 high() const noexcept;

Most significant 64 bits.

is_null

[[nodiscard]] constexpr bool is_null() const noexcept;

True for the all-zero identifier.

low

[[nodiscard]] constexpr u64 low() const noexcept;

Least significant 64 bits.

null

[[nodiscard]] static constexpr uuid null() noexcept;

The all-zero identifier. Means "none".

parse

[[nodiscard]] static std::optional<uuid> parse(
    std::string_view text) noexcept;

Parses "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" (case-insensitive, braces optional). Returns nullopt for anything else.

to_string

[[nodiscard]] std::string to_string() const;

Lower-case canonical form "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".

Operator Overloads

Public

operator<=>

[[nodiscard]] constexpr auto operator<=>(
    const uuid &) const noexcept = default;

operator==

[[nodiscard]] constexpr bool operator==(
    const uuid &) const noexcept = default;