The OpenD Programming Language

UUID.toHash

All of the standard numeric operators are defined for the UUID struct.

struct UUID
@safe pure nothrow @nogc const
size_t
toHash
()

Examples

//compare UUIDs
assert(UUID("00000000-0000-0000-0000-000000000000") == UUID.init);

//UUIDs in associative arrays:
int[UUID] test = [UUID("8a94f585-d180-44f7-8929-6fca0189c7d0") : 1,
    UUID("7c351fd4-b860-4ee3-bbdc-7f79f3dfb00a") : 2,
    UUID("9ac0a4e5-10ee-493a-86fc-d29eeb82ecc1") : 3];

assert(test[UUID("9ac0a4e5-10ee-493a-86fc-d29eeb82ecc1")] == 3);

//UUIDS can be sorted:
import std.algorithm;
UUID[] ids = [UUID("8a94f585-d180-44f7-8929-6fca0189c7d0"),
              UUID("7c351fd4-b860-4ee3-bbdc-7f79f3dfb00a"),
              UUID("9ac0a4e5-10ee-493a-86fc-d29eeb82ecc1")];
sort(ids);

Meta