A class representing a Universally Unique Identifier (UUID).
The UUID class is responsible for creating and managing universally unique identifiers. These identifiers are crucial for distinguishing objects across different systems or sessions. The class provides mechanisms for creating UUIDs, comparing them, and converting between UUIDs and their underlying 64-bit representation.
Key features:
- Default constructor generates a random UUID.
- Option to initialize a UUID with a specific 64-bit value.
- Comparison and assignment operators for ease of use.
- Implicit conversion to u64, enabling smooth integration with systems expecting a 64-bit identifier.
Typical usage:
- Use the default constructor to generate a new UUID: UUID uuid;
- Alternatively, initialize with a specific value: UUID uuid(123456789);
- Compare UUIDs using == or store them in data structures requiring unique keys.
- Note
- The UUID is internally stored as a 64-bit unsigned integer.
- Custom hash function is provided for easy use in hash-based containers such as std::unordered_map.