Add util::uuid
This commit is contained in:
parent
16dcbe9603
commit
f27a4fa26d
1 changed files with 32 additions and 0 deletions
32
libs/util/include/psemek/util/uuid.hpp
Normal file
32
libs/util/include/psemek/util/uuid.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <psemek/util/hash.hpp>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace psemek::util
|
||||||
|
{
|
||||||
|
|
||||||
|
using uuid = std::array<std::uint64_t, 2>;
|
||||||
|
|
||||||
|
static_assert(sizeof(uuid) == 16);
|
||||||
|
static_assert(alignof(uuid) == 8);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct hash<::psemek::util::uuid>
|
||||||
|
{
|
||||||
|
std::size_t operator()(::psemek::util::uuid const & uuid) const noexcept
|
||||||
|
{
|
||||||
|
std::size_t result = uuid[0];
|
||||||
|
::psemek::util::hash_combine(result, uuid[1]);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue